Creating Batch File to Map Network Drive

31 Mar

When you have a large user base its not practical to go around mapping Network drives for each person. You can either do it through domain controller Group policy or by the use of batch files. You provides the user with batch file when clicked it will map the drives for them automatically.

Batch file is also useful when for some unknown reason drive map gets disconnected each time the computer restarts. You can put the batch file in startup configuration.

to accomplish this,

  • Open notepad and type following.
  1. @echo Create new L: drive mapping
    @net use L: \\ServerName\Folder\Folder\FolderA /persistent:yes
    @echo Create new K: drive mapping
    @net use K: \\ServerName\Folder\Folder\FolderB /persistent:yes
  • Then save the file with .bat extension. Use any name.bat
  • Now navigate to where you save it and click on it
  • A command prompt should appear, Then Press any key to exit

  1. Create new L: Drive mapping >> create a new drive map with letter L.
  2. net use L: network path >> use drive map L for the specified network path
  3. Persistent:yes >> this attribute tells the system that the map is permanent.
  4. @pause >> to tell the cmd to not quit after executing the batch file.


Leave a comment

Posted by on March 31, 2019 in Windows


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: