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.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.