我需要检查磁盘名称以及是否启用了“在设备上启用写入缓存”。到目前为止,我尝试了 api 方法 DriveInfo.GetDrives ,但它没有任何可以返回我正在寻找的信息的属性或方法。
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" Drive type: {0}", d.DriveType);
}
https://msdn.microsoft.com/en-us/library/system.io.driveinfo.getdrives(v=vs.110).aspx