Object: Drive
- Updated2024-09-12
- 1 minute(s) read
(Collections | FileSystemObject) > Drives > Object: Drive
Object: Drive
You can use the Drive object to access the properties of a drive.
The following example returns the free memory space of all drives:
Function CreateDriveSpaceList 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.IsReady Then sOutput = sOutput & FormatNumber(oMyDrive.FreeSpace,0) Else sOutput = sOutput & "[Not ready]" End If sOutput = sOutput & VBCrLf Next CreateDriveSpaceList = sOutput End Function
Properties
AvailableSpace | DriveLetter | DriveType | FileSystem | FreeSpace | IsReady | Path | RootFolder | SerialNumber | ShareName | TotalSize | VolumeName