Map network path or drive via Windows batch file

  1. Knowledge Base
  2. Map network path or drive via Windows batch file

Map Command Pattern:

[command] [drive letter] [\\HostName\sharename] /user:"[DomainName\username]" [password]

Save the following code into mount_drives.bat file using notepad. For example:

net use Z: \\server01\share /user:"server01\Jonathan" MySecretCode

Full documentation on the net use command can be found on Microsoft’s Docs page here.

To auto mount on login, place the batch file into the following location:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

You may easily navigate to that path by pressing the Start menu, then typing run and then pressing enter.

The run dialogue will open. Type the command shell:common startup and press enter.

Place the mount_drives.bat file into the folder.

Leave a Reply

Your email address will not be published. Required fields are marked *