user73628
user73628

Reputation: 3765

write a batch to change the path for Mapped drive

I having server folder as a mapped network drive in workstation . Now the that folder is shifting to to another server so Ineed to change the path this activity I need to do at 400 workstations. so can you help me with script.

Upvotes: 0

Views: 6334

Answers (2)

Jonathan
Jonathan

Reputation: 1892

Given drive Letter g:

net use g: /delete
net use g: "\\server\share"

It's important to use the quotes around the path, otherwise paths with spaces will not map correctly.

Upvotes: 0

i_am_jorf
i_am_jorf

Reputation: 54600

If your old drive mapping is in O: you use this to delete it:

net use /d O:

And this to create the new one:

net use O: \\newserver\\newpath /PERSISTENT:YES 

If you have to specify a username \ password:

net use O: \\newserver\\newpath password /USER:domain\user /PERSISTENT:YES 

Upvotes: 2

Related Questions