Property: Drives for FileSystemObject
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: Drives for FileSystemObject
Property: Drives for FileSystemObject
Returns the Drives collection of the FileSystemObject object. You can use this to access drives.
Set oDrives = Object.Drives
| Object | FileSystemObject Object with this property |
| oDrive s | Drives 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