[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I map Network printers using a .bat file?

Posted on 2008-11-10
Medium Priority
Last Modified: 2013-12-15
I need to creat a .BAT file that will install all the printers on the server. It needs to deslete its self once it completes the install. The .BAT file should use the Net Use command.

Question by:Ephraim-Sturrup
  • 2
LVL 58

Expert Comment

ID: 22923744

The method at the command line for mapping printers is for legacy DOS applications since it will map a printer to an LPTx port, but won't add the printer to Windows' Control Panel > Printers area.

A better way to map printers would be a VBS script, which does add the printers to the Printers folder (and allow you to use them from your applications). The script below can be used to start with and you can add more printer connections as necessary.

'tigermatt's script
'Copy to Notepad, set printer share(s), File > Save, Files of Type: Pick 'All Files', enter "map_printer.vbs" with the quotes.
Set objNetwork = CreateObject("WScript.Network")
'Copy and paste this line and change the printer path to add more printer connections
objNetwork.AddWindowsPrinterConnection "\\server\Printer Share"

Open in new window


Author Comment

ID: 22925219
Please send me an example.
LVL 58

Accepted Solution

tigermatt earned 500 total points
ID: 22925625

The script posted at the bottom of my last comment is an example of mapping printers using a VBS script. The VBS approach is tidier, however if you require a BAT file approach, the below should do the trick. You need to change the name of the server hosting the print queue, and the name of the print queue itself.

rem Map a Printer
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer

Open in new window


Expert Comment

ID: 29878166
I like this bat files, however what can we add to this bat files to make this network printer become the default

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You have seen this as an option on your internet browser before or it may be completely new to you.  But what does this mean and why would I use this?
pc, laptop  monitor connection configurations
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question