Map a drive using a batch file

You can map a network drive using a script or batch file.

Open up Notepad

Type the following in substituting computer with the computer you are connecting to.  You will also substitute the folder with the folder name that is shared (only share with who you want to have access) also you can type in the password and username as necessary.

After typing this information in, Click on File and Save As.   Type map.bat and select the file type as all files.  Save the file where you want it.  You can now add it to your startup or to a schedule you set.

net use P: \\computer\folder password /user:username



If you want to disconnect the drive after a period of time, follow the above steps substituting –

net use P: /delete

About TCAT Shelbyville IT Department

The Tennessee College of Applied Technology - is one of 46 institutions in the Tennessee Board of Regents System, the seventh largest system of higher education in the nation. This system comprises six universities, fourteen community colleges, and twenty-six Applied Technology Colleges.
This entry was posted in Computers and tagged , , , . Bookmark the permalink.

One Response to Map a drive using a batch file

  1. jookool says:

    The batch file I use is a .vbs
    Open Notepad type in Set objNetwork = CreateObject(“WScript.Network”)
    objNetwork.MapNetworkDrive “H:” , “\\network path here\folder”

    Save as .VBS
    I know this works in Windows XP and the netuse command seems to give more erros when custom Goup Policys are in place.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s