Bat文件或其他方式来创建映射驱动器并重命名它们

时间:2023-01-26 21:57:20

I have a bat file already with my mapped drive info, but is there a way to have the bat rename the drives so when the how up in "my computer" they will be labeled properly?

我有一个bat文件已经有我的映射驱动器信息,但有没有办法让蝙蝠重命名驱动器,所以当“我的电脑”中的它们将如何正确标记?

1 个解决方案

#1


0  

You can use comobject like this (powershell code):

您可以像这样使用comobject(powershell代码):

$desc=  "MyNetworkshare" # This is the label for your unit
$mDrive =  "H:\" #this is your unit (any letter you have..)
$oShell = new-Object -com Shell.Application
$oShell.NameSpace($mDrive).Self.Name = $Desc

#1


0  

You can use comobject like this (powershell code):

您可以像这样使用comobject(powershell代码):

$desc=  "MyNetworkshare" # This is the label for your unit
$mDrive =  "H:\" #this is your unit (any letter you have..)
$oShell = new-Object -com Shell.Application
$oShell.NameSpace($mDrive).Self.Name = $Desc