Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create MAP Drive by batch file

often i have to create map drive where i specify machine and user credential. now i like to know can we write a batch file which will create map drive and where i provide all details like pc and folder location and user credentials etc. i got one as follows but i think this is not one which i require. please guide me. thanks

net use \\<network-location>\<some-share>\ password /USER:username

@echo Create new L: drive mapping
@net use L: \\network path /persistent:yes
@echo Create new K: drive mapping
@net use K: \\network path /persistent:yes
:exit

if i do this way...then does it work

net use y: \\192.168.7.15\$D\testfolder password /USER:username  /PERSISTENT:YES

please guide.....the syntax is ok?

like image 354
Thomas Avatar asked Jun 27 '26 19:06

Thomas


1 Answers

I presume your testfolder is shared then do like this:

net use z: \\192.168.7.15\testfolder password /user:domain\username /savecred /p:yes
like image 200
Sunny Avatar answered Jun 30 '26 09:06

Sunny