使用Mountvol命令掛載時,發現GUID不對啊,哪應該到哪找呢?
1.首先可以用Mountvol命令:
Mountvol
創建、刪除或列出卷的裝入點。Mountvol 是一種不需要驅動器號而連接卷的方式。
語法:
mountvol [Drive:]Path VolumeName
mountvol [Drive:]Path /d
mountvol [Drive:]Path /l
mountvol [Drive:]Path /p
mountvol /r
mountvol /n
mountvol /e
mountvol Drive:/s
參數:
[Drive:]Path
??? 指定裝入點將駐留其中的現有 NTFS 目錄文件夾。?
VolumeName
??? 指定裝入點目標卷的卷名。該卷名結構為 \\?\Volume{GUID}\,其中 {GUID} 為全局唯一標識符 (GUID)(例如,\\?\Volume\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\)。?
/d
??? 從指定文件夾中刪除卷裝入點。?
2.GUID在哪找?
ODD屬性-Details-Property有個Class Guid,這是不是的。
查看文章
https://social.technet.microsoft.com/Forums/en-US/e7b2ddd6-f245-49ed-8fec-3b6e08e75369/how-do-i-find-the-partition-guid?forum=winservergen
有這樣說法,可以用win32_volume查看
-----------------------------------------------------------------------------------------------------------------------------------------------
GWMI -namespace root\cimv2 -class win32_volume | FL -property Label,DriveLetter,DeviceID,SystemVolume,Capacity,Freespace
-----------------------------------------------------------------------------------------------------------------------------------------------
3.C#代碼:
ManagementObjectSearcher deviceList = new ManagementObjectSearcher("Select DriveLetter, DeviceID,DriveType,Name from Win32_Volume ");
foreach (ManagementObject device in deviceList.Get())
{
string name = Convert.ToString(device.GetPropertyValue("Name"));
string DriveType = Convert.ToString(device.GetPropertyValue("DriveType"));
string DeviceID = Convert.ToString(device.GetPropertyValue("DeviceID"));
}
這里的DeviceID就是GUID
相關鏈接:
http://blog.csdn.net/holandstone/article/details/8129180
https://social.technet.microsoft.com/Forums/en-US/e7b2ddd6-f245-49ed-8fec-3b6e08e75369/how-do-i-find-the-partition-guid?forum=winservergen