Returns True if the specified drive exists; False if it does not.
object.DriveExists(drivespec)
For drives with removable media, the DriveExists method returns true even if there are no media present. Use the IsReady property of the Drive object to determine if a drive is ready.
The following example illustrates the use of the DriveExists method.
[JScript] function ReportDriveStatus(drv) { var fso, s = ""; fso = new ActiveXObject("Scripting.FileSystemObject"); if (fso.DriveExists(drv)) s += "Drive " + drv + " exists."; else s += "Drive " + drv + " doesn't exist."; return(s); } [VBScript] Function ReportDriveStatus(drv) Dim fso, msg Set fso = CreateObject("Scripting.FileSystemObject") If fso.DriveExists(drv) Then msg = ("Drive " & UCase(drv) & " exists.") Else msg = ("Drive " & UCase(drv) & " doesn't exist.") End If ReportDriveStatus = msg End Function
Drive Object | Drives Collection | FileExists Method | FolderExists Method | GetDrive Method | GetDriveName Method | IsReady Property
Applies To: FileSystemObject Object