title: Get drive label in C#
body: <p>When I use <code>System.IO.DriveInfo.GetDrives()</code> and look at the <code>.VolumeLabel</code> property of one of the drives, I see "PATRIOT XT", which is indeed the drive's volume label.</p>
  
  <p>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 <code>DriveInfo</code> properties hold that value. I also tried querying the information via WMI's <code>Win32_LogicalDisk</code>, but no properties contained that value there either.</p>
  
  <p>So any idea what the label My Computer uses is called, and more importantly, how to programmatically retrieve it?</p>
  
  <p>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):</p>
  
  <pre><code>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
      );
  </code></pre>
  
  <pre>
  Removable (A:)
  Fixed (C:)
  CDRom (D:)
  PATRIOT XT (E:)
  Backup (Y:)
  Data (Z:)
  </pre>
  
  <p>My Computer details view displays:</p>
  
  <pre>
  Floppy Disk Drive (A:)
  Local Disk (C:)
  DVD RW Drive (D:)
  TrueCrypt Traveler Disk (E:)
  Backup (Y:)
  Data (Z:)
  </pre>