问题
I need to create a script or batch file to run on multiple computers that unmaps a network share \\serverName\shareName
and maps a new network share \\newServer\newShareName
I can unmap the network drives by using:
net use /delete X:
and map the new share with:
net use * \\newServer\newShareName
but the problem is the drive letter is going to be different on every computer.
How would I check what letter \\serverName\shareName
is mapped to?
回答1:
for /f "tokens=2,3" %%i in ('net use') do if '%%j=='\\servername\sharename set drive=%%i
this should work ;)
来源:https://stackoverflow.com/questions/19555441/how-to-get-drive-letter-of-mapped-network-drive