/// <summary> /// 获取剩余空间最大的逻辑磁盘名称 /// </summary> public static string GetMaxFreeSizeLogicalDisk() { var objects = new ManagementClass(WMIPath.Win32_LogicalDisk.ToString()).GetInstances().Cast <ManagementObject>().ToArray(); return(objects.OrderByDescending(m => Convert.ToInt64(m.Properties["FreeSpace"].Value)) .Select(m => (string)m.Properties["Caption"].Value) .FirstOrDefault()); }