Name
FileSystemObject.GetAbsolutePathName Method
Syntax
oFileSysObj
.GetAbsolutePathName(Path
)
oFileSysObj
Use: Required
Data Type: FileSystemObject object
A FileSystemObject object.
Path
Use: Required
Data Type: 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.I
fPath
is simply a filename without a path, the method concatenates the complete path to the current directory with the filename. 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 and 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 a particular ...
Get VBScript in a Nutshell, 2nd Edition 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.