CMD命令硬盘/光驱挂载

使用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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值