When I use System.IO.DriveInfo.GetDrives()
and look at the .VolumeLabel
property of one of the drives, I see "PATRIOT XT", which is indeed the drive's volume label.
If I open "My Computer", instead I see "TrueCrypt Traveler Disk", and I can't seem to find any way to programmatically retrieve that value as none of the DriveInfo
properties hold that value. I also tried querying the information via WMI's Win32_LogicalDisk
, but no properties contained that value there either.
So any idea what the label My Computer uses is called, and more importantly, how to programmatically retrieve it?
EDIT: To be clear, here's the code I'm using, followed by what it outputs, followed by what I see in My Computer (which is what I want to duplicate):
foreach (DriveInfo DI in DriveInfo.GetDrives())
richTextBox1.AppendText(
(
DI.IsReady ?
(DI.VolumeLabel.Length == 0 ? DI.DriveType.ToString() : DI.VolumeLabel) :
DI.DriveType.ToString()
)
+
" (" + DI.Name.Replace("\\", "") + ")"
+ Environment.NewLine
);
Removable (A:) Fixed (C:) CDRom (D:) PATRIOT XT (E:) Backup (Y:) Data (Z:)
My Computer details view displays:
Floppy Disk Drive (A:) Local Disk (C:) DVD RW Drive (D:) TrueCrypt Traveler Disk (E:) Backup (Y:) Data (Z:)