Home NT Commands
NT Syntax

CON2PRT.exe (Zero Admin Kit)

Add a network printer to the Control Panel - Printers folder, and/or Disconnect a printer.

Note that the NET USE command can map a network printer to an LPT port (for DOS type applications that print to a port.) but this does not add the printer to Control Panel - Printers.

All commands issued using this utility will affect only the user currently logged in. Con2prt is therefore ideal for managing NETWORK printer connections when used in a login script.

Syntax 
      CON2PRT /f
      CON2PRT /c \\PrintServer\PrintShare
      CON2PRT /cd \\PrintServer\PrintShare

Key
       /f  - remove all network printer connections
       /c  - connect to \\PrintServer\PrintShare
       /cd - connect to and set PrintShare as the default printer       

Several switches can be combined in one command line. So you can remove all connections before adding new ones all in one command, you can only specify one default printer.

Available for free download at:
http://www.microsoft.com/windows/zak/

Related Commands:

PRINT
- Print a text file
NET VIEW - to view a list of printers
NET PRINT - View and Delete print jobs
PRNCNFG - Display, configure or rename a printer
PRNDRVR - Add, delete or list printer drivers.
PRNJOBS - Pause, resume, cancel, or list print jobs
PRNMNGR - Add, delete, or list printers / connections, set the default printer.
PRNPORT - Create, delete, or list TCP/IP printer ports, change port configuration.
PRNQCTL - Print a test page, pause or resume a printer, clear a printer queue.

WSH Commands:
Add printer - WshNetwork.AddPrinterConnection
Add Network printer - WshNetwork.AddWindowsPrinterConnection
List printers - WshNetwork.EnumPrinterConnections
Set default printer - WshNetwork.SetDefaultPrinter

Equivalent Linux BASH commands:

lpc - Line printer control program
lpr - Off line print
lprint - Print a file
lprintd - Abort a print job
lprintq - List the print queue
lprm - Remove jobs from the print queue


Simon Sheppard
SS64.com