Visual Basic Scripting Edition | Language Reference |
Returns a string containing the base name of the file (less any file extension), or folder in a provided path specification.
object.GetBaseName(path)
object
Required. Always the name of a FileSystemObject.
path
Required. The path specification for the file or folder whose base name is to be returned.
The GetBaseName method returns a zero-length string ("") if no file or folder matches the path argument.
The following example illustrates use of the GetBaseName method:
Function GetTheBase(filespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheBase = fso.GetBaseName(filespec)
End Function
Note The GetBaseName method works only on the provided path string. It does not attempt to resolve the path, nor does it check for the existence of the specified path.
GetAbsolutePathName Method | GetDrive Method | GetDriveName Method | GetExtensionName Method | GetFile Method | GetFileName Method | GetFolder Method | GetParentFolderName Method | GetSpecialFolder Method | GetTempName Method
Applies To: FileSystemObject Object