CL tip #1 – Windows XP Adding a TCP/IP Printer

Here is how to add a Printer to a Windows XP System from the Command Line.

Here is what is needed


  • IP address of the Printer
  • Printer Name (your choice)
  • Port Name (Your choice)
  • Driver Location (can be a mapped drive)
  • Name of the Printer, based on the manufacturer(This must be exact)


For this example, I use the following values


  • “LJ_4200”
  • IP_
  • “\fs1PublicIT_StuffDriversPrintersHP 4200 Driverhpc4200c.INF”
  • “HP LaserJet 4200 PCL 6”



Now here is the magic.

cscript “c:windowssystem32prnport.vbs” -a -r VIP_ -h -o raw -n 9100

rundll32 printui.dll,PrintUIEntry /if /b “LJ_4200” /f “\fs1PublicIT_StuffDriversPrintersHP 4200 Driverhpc4200c.INF” /r “VIP_172.16.170.21″ /m “HP LaserJet 4200 PCL 6”


The first line creates a local TCP/IP Port. The second Line creates the actual printer


If everything goes fine, the printer should appear in the “Printer Control Panel”


Leave a Reply

Your email address will not be published. Required fields are marked *