Gets the names of all the partitions in a system. Note that media must be in every removable drive for this to work (can be fixed easily)

' GetHDInfo - Get names of all the partitions and drives on a system

Dim FSO, d, Drives, MyStr, n
' Create the FileSystemObject
Set FSO = CreateObject("Scripting.FileSystemObject")
' Get the list of drives
Set Drives = FSO.Drives
' Go through the drives and get names
For Each d In Drives
    MyStr = MyStr & d.DriveLetter & " - "
    If d.DriveType = 3 Then
        n = d.ShareName
        n = d.VolumeName
    End If
    MyStr = MyStr & n & vbCrLf
MsgBox MyStr
About the Author
Member Avatar alex_extreme Light Poster

Umm, well... I'm me, aka Alex. I'm developing an operating system called Exclaim - I also do some web developing. I can code C, C++, Python, PHP and Bash scripting


how to use?
..where should i put this coding?

Mark A

If a drive has no title or the title is "" then can't read d.VolumeName and program will crash.


n = d.VolumeName


On Error Resume Next
        n = ""
        n = d.VolumeName