Mapping network drive using batch file

Here is the command for mapping a network drive which is password protected using batch file.

Open notepad and type the following command and save it as map.bat.

This example will map a computer with name “pc1” and shared folder name “share1”. The username required to connect is “user1” and password is “password1”. After executing the command the drive letter will be k.


net use k: \\pc1\share1 password1 /user:user1 /persistent:yes.