Javascript FSO GetAbsolutePathName Method

Updated on 26 Mar 2012,
Published on 30 Sep 2008

GetAbsolutePathName method of Javascript FileSystemObject (FSO) provides the functionality to get or map the absolute path for the specified file or folder. FSO GetAbsolutePathName method returns the canonical representation of the path for the specified file or folder. This method maps the specified file with current path of the FileSystemObject at client side. GetAbsolutePathName method generates the complete path for the specified file or folder. 

Syntax for Javascript FSO GetAbsolutePathName Method

fso.GetAbsolutePathName( path );

As shown in the above syntax of GetAbsolutePathName method, it accepts only one parameter as path for any file or folder.

Example of FSO GetAbsolutePathName Method

Following are the example of different types of path mapping using GetAbsolutePathName method:

<script type="text/javascript">
    // initialize ActiveXObject and create an object of Scripting.FileSystemObject.
    var fso = new ActiveXObject("Scripting.FileSystemObject");

    var fPath = fso.GetAbsolutePathName(".");
    document.write(fPath);
    document.write("<br />");

    fPath = fso.GetAbsolutePathName("/");
    document.write(fPath);
    document.write("<br />");

    fPath = fso.GetAbsolutePathName("/Temp");
    document.write(fPath);
    document.write("<br />");

    fso = null;

    // Output: 
    // C:\Documents and Settings\Administrator\Desktop 
    // C:\ 
    // C:\Temp
</script>

Continue to next tutorial: Javascript FSO GetBaseName Method to learn how to get the base name of the specified file or folder.

0 Responses to "Javascript FSO GetAbsolutePathName Method"
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email
  • HIRE EzineASP.Net Developers