How to Add a Printer With a Batch Script

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Add a Printer With a Batch Script
(Thomas Northcut/Photodisc/Getty Images)

Batch scripts are Windows command line files that execute due to the ".BAT" file extension. Batch files are commonly used by network administrators to automate the process of making printers available to network users. To add a printer, only two lines of code are needed in a batch file, which are written using the free text editor included with the Windows operating system.

Skill level:


  1. 1

    Click the Windows "Start" button. Type "notepad" into the search text box on the pop-up menu. Press "Enter" to open Notepad.

  2. 2

    Type the following code for the first batch file line:

    rundll32 printui.dll,PrintUIEntry /ia /c\server /m "AGFA-AccuSet v52.3" /h "Intel" /v "Windows 7" /f %windir%\inf\ntprint.inf

    Replace "server" with the name of the computer that has the Windows print drivers. This can be the local computer or a network server. "AGFA-AccuSet v52.3" represents the driver name. Replace "Intel" with the name of your server.

  3. 3

    Add the following line into the text editor, which connects the printer to a port on the computer:

    rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\SERVER /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"

    This line is similar to the line of code in Step 2, but this line adds the printer to "lpt1." Replace this command with the port. If there is only one printer installed on the computer, then "lpt1" works for the local computer settings. Like the line of code in Step 2, replace "server" with your server name, and "AGFA-AccuSet v52.3" is your printer driver name.

  4. 4

    Click the Notepad "File" menu item and select "Save As." Select "All Files" from the "File type" drop-down box. Type "addprinter.bat" for the file name. Click "Save."

  5. 5

    Test your new file by double-clicking it on your computer. The batch file executes and adds the printer to your computer.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.