DIAdem Help

Property: Drives for FileSystemObject

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

Property: Drives for FileSystemObject

Returns the Drives collection of the FileSystemObject object. You can use this to access drives.

Set oDrives = Object.Drives
ObjectFileSystemObject
Object with this property
oDrive sDrives
Returned object

The following example generates a collection of all drives:

Function CreateDriveList
  Dim fso, oMyDrive, oMyDrives, sOutput
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set oMyDrives = fso.Drives
  For Each oMyDrive in oMyDrives
    sOutput = sOutput & oMyDrive.DriveLetter & VBTab 
    If oMyDrive.DriveType = 3 Then
      sOutput = sOutput & oMyDrive.ShareName
    ElseIf oMyDrive.IsReady Then
      sOutput = sOutput & oMyDrive.VolumeName
    Else
      sOutput = sOutput & "[Not ready]"
    End If
    sOutput = sOutput & VBCrLf
  Next
  CreateDriveList = sOutput
End Function

Log in to get a better experience