DIAdem Help

Method: DriveExists for FileSystemObject

  • Updated2024-09-12
  • 1 minute(s) read

Method: DriveExists for FileSystemObject

Checks whether a drive exists.

bDriveExists = Object.DriveExists(DriveSpec)
ObjectFileSystemObject
Object with this method
DriveSpecString
Specifies the drive or the drive path.
bDriveExistsBoolean
If the drive exists, the value is True. If the drive does not exist, the value is False. The value is also True for the removable media, if no disk is in the drive.

The following example checks whether a disk drive exists:

Function DriveStatus(sDrv)
  Dim fso, sOutput
  Set fso = CreateObject("Scripting.FileSystemObject")
  If fso.DriveExists(sDrv) Then
    sOutput = ("Drive " & sDrv & " exists.")
  Else
    sOutput = ("Drive " & sDrv & " doesn't exist.")
  End If
  DriveStatus = sOutput
End Function

Log in to get a better experience