Returns a string containing the extension name for the last component in a path.
object.GetExtensionName(path)
For network drives, the root directory (\) is considered to be a component.
The GetExtensionName method returns a zero-length string ("") if no component matches the path argument.
The following example illustrates the use of the GetExtensionName method.
[JScript] function ShowExtensionName(filespec) { var fso, s = ""; fso = new ActiveXObject("Scripting.FileSystemObject"); s += fso.GetExtensionName(filespec); return(s); } [VBScript] Function GetAnExtension(DriveSpec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") GetAnExtension =fso.GetExtensionName(
Drivespec)
End Function
GetAbsolutePathName Method | GetBaseName Method | GetDrive Method | GetDriveName Method | GetFile Method | GetFileName Method | GetFileVersion Method | GetFolder Method | GetParentFolderName Method | GetSpecialFolder Method | GetTempName Method
Applies To: FileSystemObject Object