Microsoft® Visual Basic® Scripting Edition DriveExists Method |
Language Reference Version 3 |
Returns True if the specified drive exists; False if it does not.
object.DriveExists(drivespec)The DriveExists method syntax has these parts:
Part Description object Required. Always the name of a FileSystemObject. drivespec Required. A drive letter or a complete path specification.
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 use of the DriveExists method:
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