Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to create a BATCH script that will add a printer locally using the TCP/IP port. I am assuming the arguments needed would be the printers name, driver location (.inf), IP address, and computer name.

Anyone able to help?

share|improve this question
up vote 4 down vote accepted

You can accomplish this with a few calls to printui - see this page for more information. It sounds like you would want to call

rundll32 printui.dll,PrintUIEntry /ga

Though I am not certain how to specify a printer via INF file over the network.

A few years ago, I wrote a script to install printers over the network. This script is intended for use with printers shared over samba, so you don't need to specify a driver. If you're trying to add a printer that isn't shared in this way, I'm not sure that this will work. Perhaps you can use this as a starting point though to figure out how to do it.

@echo off
::This script adds a single printer to the default user profile.
::NOTE:  Printer names with spaces will NOT be accepted.  
::Usage: run addprinters and follow onscreen directions

echo This script adds the specified local or network printer  
echo to the deafult account for all existing/new users.  
echo *IMPORTATNT* Printer names with spaces will NOT be accepted.
echo *******************************************************

SET /P target=Enter target computer name (this compupter)  
SET /P printer=Enter Printserver/Printername (do not include \\) 
echo Attempting to add %printer% for all users on %target%

rundll32 printui.dll,PrintUIEntry /ga /c\\%target% /n\\%printer%
echo New printers will NOT appear until spooler is restarted.
SET /P reset=Reset print spooler Y/N?     
if "%reset%"=="y" goto spooly
goto end

start /wait sc \\%target% stop spooler
start /wait sc \\%target% start spooler
echo Print Spooler Service restarted.


Simply save this text to a .cmd file and run it if you want to give it a try.

share|improve this answer
I am caught up with other issues at the moment so this project is on a back burner for now, I have not forgotten about your answer. When I have the time I will try it out. Thanks! – qroberts Jul 28 '11 at 16:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.