GetDriveName Method |
Description
Returns a string containing the name of the drive for a specified path.
PowerBASIC Syntax
Arguments
Return Value
BSTR. The name of the drive.
Remarks
The GetDriveName method returns a zero-length string (") if the drive can't be determined. The GetDriveName 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.
Example [PowerBASIC]
#INCLUDE "windows.inc" #INCLUDE "scrrun.inc"
DIM fso AS IFileSystem DIM strName AS STRING
' Create an instance of the FileSystemObject fso = NEWCOM "Scripting.FileSystemObject" ' Get the drive name from a path strName = fso.GetDriveName(UCODE$("C:\MyFolder\Test.txt"))
|