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.filenamereturns the drive letter and path up to and including filename within the current folder. For example, if the current folder isC:\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
Pathat 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access