我有一个脚本,在其中我需要取消映射驱动器并存储其路径,然后重新映射它。我知道我可以找到驱动器已映射并使用删除它
if exist z:\ (
net use z: /delete
)
当我做net use Z:
我得到
Local name Z:
Remote name \\networkpath\to\drive
Resource type Disk
Status OK
# Opens 0
# Connections 1
The command completed successfully.
我想使用远程名称在脚本末尾重新映射驱动器。PS建议如何获取远程名称,以便我可以做net use z: \\networkpath\to\drive
for /f "tokens=2*delims= " %%a in ('net use z:') do if "%%a"=="name" set "remotename=%%b"
echo %remotename%
应该提取该数据
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句