When I log into a new computer, I don’t like having to do a whole lot of configuration. Net use command is the command line tool for mapping shared drives and printers. You can combined it with a batch script to map shared storage drives and printers. Now you have a really efficient tool at your disposal. Here is a sample of one of my scripts. If you would like to try and make your own batch script to automatically map a shared drive or printer with a click of an icon on your desktop. Open up your notepad app and copy / paste the following script. Once you are done editing the script in notepad app – Save it as a “.bat
” file.
- Swap out the placeholder with your share’s IP address (In example:
\\192.168.X.X
or\\domain.local
). - If your share has spaces in its name use “
\\yourserver.local\share name
“ - Add as many shares and printers as you want by adding more
Net Use
lines in the script.
Shared Drive Mapping Sample
echo off
title S Drive Automatic Mapping.
echo Creating new S: Drive Mapping...
net use S: \\yourserver.local\share
:exit
pause
Shared Printer Mapping using Net Use command
echo off
echo Mapping YourLocation Printer and Copier...
rundll32 printui.dll PrintUIEntry /in /n \\yourserver.local\PrinterName\
echo Mapping Maintenance Control Printer and Copier...
Net Use LPT1 \\yourserver.local\PrinterName\ /Persistent:Yes
:exit
pause