3

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?

Arvin
  • 1,391
  • 4
  • 19
  • 33

1 Answers1

6
for /f "tokens=2,3" %%i in ('net use') do if '%%j=='\\servername\sharename set drive=%%i

this should work ;)

cure
  • 2,588
  • 1
  • 17
  • 25