Dim FSO, drive, space ,dc,t
Set FSO = CreateObject("Scripting.FileSystemObject") 'CreateObject to create the File System Object
set drive= FSO.drives ' To fetch All the drives detail from the system
Result= "Drives in system = " & vbcrlf
For Each i in drive
Select Case i.DriveType ' To get the Drive Type
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
Result= Result& "Drive " & i.DriveLetter & ": - " & t & vbcrlf
temp = ""
Result= Result& i.DriveLetter & " - " 'DriveLetter is to get th Driver Letter like C for C:\
If i.DriveType = 3 Then
temp = i.ShareName
ElseIf i.IsReady Then
temp = i.VolumeName
Else
temp = "Drive not available"
End If
Result= Result& temp & vbcrlf
Set drive = FSO.GetDrive(FSO.GetDriveName(i))
Result = Result & "Drive " & UCase(drvPath) & " - "
Result = Result & drive.VolumeName & " "& vbcrlf
Result = Result & "Free Space: " & FormatNumber(drive.FreeSpace/1024/1024, 2)
Result = Result & " Mbytes" & vbcrlf
Result = Result & "Total Space: " & FormatNumber(drive.TotalSize/1024/1024, 2) & vbcrlf
Result = Result & " Mbytes" & vbcrlf & vbcrlf
Next
Result= Result& vbcrlf
MsgBox Result
Set FSO = CreateObject("Scripting.FileSystemObject") 'CreateObject to create the File System Object
set drive= FSO.drives ' To fetch All the drives detail from the system
Result= "Drives in system = " & vbcrlf
For Each i in drive
Select Case i.DriveType ' To get the Drive Type
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
Result= Result& "Drive " & i.DriveLetter & ": - " & t & vbcrlf
temp = ""
Result= Result& i.DriveLetter & " - " 'DriveLetter is to get th Driver Letter like C for C:\
If i.DriveType = 3 Then
temp = i.ShareName
ElseIf i.IsReady Then
temp = i.VolumeName
Else
temp = "Drive not available"
End If
Result= Result& temp & vbcrlf
Set drive = FSO.GetDrive(FSO.GetDriveName(i))
Result = Result & "Drive " & UCase(drvPath) & " - "
Result = Result & drive.VolumeName & " "& vbcrlf
Result = Result & "Free Space: " & FormatNumber(drive.FreeSpace/1024/1024, 2)
Result = Result & " Mbytes" & vbcrlf
Result = Result & "Total Space: " & FormatNumber(drive.TotalSize/1024/1024, 2) & vbcrlf
Result = Result & " Mbytes" & vbcrlf & vbcrlf
Next
Result= Result& vbcrlf
MsgBox Result