Name

FileSystemObject.GetAbsolutePathName Method

Syntax

                  oFileSysObj.GetAbsolutePathName(Path)
oFileSysObj

Use: Required

Data Subtype: FileSystemObject object

Any object variable returning a FileSystemObject object.

Path

Use: Required

Data Subtype: String

A path specifier.

Return Value

A string containing the absolute path of a given path specifier.

Description

Converts a relative path to a fully qualified path, including the drive letter.

Rules at a Glance

  • (.) returns the drive letter and complete path of the current folder.

  • (..) returns the drive letter and path of the parent of the current folder.

  • filename returns the drive letter and path up to and including filename within the current folder. For example, if the current folder is C:\Documents\MyScripts, then the method call:

    sFileName = GetAbsolutePathName("MyFile.txt")

    produces the string “C:\Documents\MyScripts\MyFile.txt”.

  • All relative pathnames are assumed to originate at the current folder. This means, for example, that (.) returns the drive letter and complete path of the current folder, and that (..) returns the drive letter and path of the parent of the current folder.

  • If a drive isn’t explicitly provided as part of Path, it’s assumed to be the current drive.

  • Wildcard characters can be included in Path at any point.

Programming Tips & Gotchas

  • An absolute path provides a complete route from the root directory of a particular drive to a particular folder or file. In contrast, a relative path describes a route from the current folder to ...

Get VBScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.