O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileSystemObject.GetDriveName Method

Syntax

                  oFileSysObj.GetDriveName (Path)
oFileSysObj

Use: Required

Data Type: FileSystemObject object

A FileSystemObject object.

Path

Use: Required

Data Type: String

A path specifier.

Return Value

A String.

Description

Returns the drive name of a given path.

Rules at a Glance

If the drive name can’t be determined from the given path, a zero-length string (” “) is returned.

Programming Tips and Gotchas

  • For local and mapped drives, GetDriveName appears to look for the colon as a part of the drive’s name to determine whether a drive name is present. For network drives, it appears to look for the computer name and drive name.

  • GetDriveName is really a string-parsing method rather than a filesystem method. In particular, it does not verify that the drive name that it extracts from Path actually exists on the system.

  • Path can be a network drive or share.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required