My objective is to get the "label" information for the different
volumes that are mounted. I want to display the same information as
Windows Explorer. I wrote this test code with gets me the drive
letter, but the label is always blank. Any thoughts?
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo di in drives)
{
Console.WriteLine("----------------------");
if (di.IsReady)
{
Console.WriteLine("label: {0}", di.VolumeLabel);
Console.WriteLine("Format: {0}", di.DriveFormat);
Console.WriteLine("Name: {0}", di.Name);
}
Console.WriteLine("Root Directory: {0}", di.RootDirectory);
Console.WriteLine("Type: {0}", di.DriveType);
Console.WriteLine("Is Ready: {0}", di.IsReady);
}