20, Dec, 2024

How to: Creating Batch File to Map Network Drive

If you want to save time by creating a batch file that when you click on it it will automatically map the drive for you. Or if the map network drive keeps disconnecting every time you restart your computer, then you can put the batch file in the startup folder so that it runs every login.

Step 1:

Open Notepad (Start>Run>Type Notepad or Start>Programs>Accessories>Notepad

Step 2:

Type @echo Create new F: drive mapping (The drive letter could be any letter)

Step 3:

Type @net use F: \\Network path /persistent: yes (The Network path is the path where you want to mapped to)

Step 4:

If you want to mapped multiple drive just keep repeating step 2 and 3

Step 5:

Type :exit

Step 6:

@pause

Step 7:

Click File and select Save As

Step 8:

Navigate to where you want to save it

Step 9:

Name it and Make sure at the end of the name you add .bat

Step 10:

Click OK

Step 11:

Now navigate to where you save it and click on it

Step 12:

A command prompt should appear

Step 13:

Then Press any key to exit

It should looks something like this:

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