ADDPRINTER — Install a printer on the local machine.

Syntax:
ADDPRINTER printername drivername ​/A:address ​/C:comment ​/D ​/I:filename ​/L:location ​/O ​/P:port ​/Q:queue ​/R:filename ​/T

printernamethe name to give the new printer
drivernameas listed in the printer’s installation .INF file
/A:addressa dotted-quad IP address or hostname; a TCP/IP port will be created
/C:commentan optional comment, 255 characters max
/Dmake the new printer the default
/I:filenamefilename of the printer’s installation .INF file
/L:locationthe printer’s physical location; 255 characters max
/Oonly install if the named printer doesn’t already exist
/P:portname of an existing printer port
/Q:queuethe queue name for an LPR port
/R:filenameread printer settings from a data file
/Tsend a test page after installing

You must supply both the printername and drivername parameters. /I:filename might not be necessary if Windows includes support for the printer, or if the driver is already installed on the local computer.

Specify either /A:address or /P:port, but not both. /P will use an existing printer port; /A will automatically create a TCP/IP port for the specified address. The new IP port will be a raw TCP port unless /Q:queue is specified, in which case an LPR port will be created.

If you need to specify a TCP port number, append it to the IP address with a colon, e.g. /A:192.168.10.24:9101.

If you specify /I:, AddPrinter will search for the tag <Win> in the filename and, if found, replace it with a string indicating the Windows version. This allows you to supply more than one driver, and select the appropriate one at runtime.

<Win>
XPWindows XP, Server 2003
VistaWindows Vista, Server 2008
Win7Windows 7, Server 2008 R2
Win8Windows 8, Windows 8.1, Server 2012
Win10Windows 10, Server 2016
Winx.yunknown version of Windows; major version x, minor version y

For example, if you type /I:"Drivers\​Yoyodyne 4200n\​<Win>\​oemsetup.inf", the filename will be expanded at runtime to e.g. “Drivers\Yoyodyne 4200n\XP\oemsetup.inf” or “Drivers\Yoyodyne 4200n\Win7-x64\oemsetup.inf”. (If a driver supports more than one operating system, consider using NTFS junctions to map one directory to another.)

If you need to distinguish between x86 and x64 environments, you can use <x64>. This tag is ignored in x86 environments, but replaced with “-x64” in 64-bit environments. For example, if you type /I:"Printers\​DrizzleJet 6502<x64>\​oemsetup.inf", the filename will be either “Printers\DrizzleJet 6502\oemsetup.inf” or “Printers\DrizzleJet 6502-x64\oemsetup.inf”, as appropriate.

Case is not significant in the <Win> and <x64> tags. Remember to quote any parameter containing spaces, less-than or greater-than signs, or any other special characters.

If you specify /R:, ADDPRINTER will attempt to load printer settings from the specified data file. You would create the data file using a PRINTERDATA /S command, saving settings from the exact same printer. Doing this allows you to configure default options like paper trays, duplexing, secured or locked printing, and so on, on one computer; then replicate the printer with its customizations to other systems. The filename supports the same tags as in /I:.

addprinter "LaserJet in Office" "HP LaserJet 4050 Series PCL6" /a:192.168.0.16


•  Note: Installing printer drivers under Vista or later will require elevation (“Run as Administrator”.)