System command

prnmngr command

Adds, deletes, and lists printers or printer connections, in addition to setting and displaying the default printer. This guide lists the documented syntax and parameters for prnmngr; check Microsoft Learn for version, role and execution-context requirements.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

cscript prnmngr {-a | -d | -x | -g | -t | -l | -?}[c] [-s <Servername>] [-p <Printername>] [-m <printermodel>] [-r <portname>] [-u <Username>] [-w <password>]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

cscript prnmngr -a -p colorprinter_2 -m "color printer Driver1" -r lpt1:

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

cscript prnmngr -d -s HRServer -p colorprinter_2

Parameters, options and clauses

Option / clauseDescription
-a / -dAdd a local printer connection or delete a printer connection.
-xDelete all printers on the selected server; if omitted, the local computer is used.
-g / -tDisplay the default printer or set the default printer selected by -p.
-lList installed printers on the selected server or local computer.
cApply a supported operation to printer connections; Microsoft documents it with -a and -x.
-s <Servername>Manage printers on a remote computer; omit to use the local computer.
-p <Printername>Select the printer to manage.
-m <printermodel>Specify the printer driver model when adding a printer.
-r <portname>Select the printer port, such as LPT1:, COM1: or a configured TCP/IP port.
-u <Username> -w <password>Provide credentials authorized to manage the target computer. Avoid exposing passwords in shell history.
-?Display command help.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory