System command

prnport command

Creates, deletes, and lists standard TCP/IP printer ports, in addition to displaying and changing port configuration. This guide lists the documented syntax and parameters for prnport; 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 prnport {-a | -d | -l | -g | -t | -?} [-r <portname>] [-s <Servername>] [-u <Username>] [-w <password>] [-o {raw | lpr}] [-h <Hostaddress>] [-q <Queuename>] [-n <portnumber>] -m{e | d} [-i <SNMPindex>] [-y <communityname>] -2{e | -d}

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

Syntax pattern

Syntax pattern from Microsoft Learn; replace placeholders and choose only one documented alternative before use.

cscript prnport {-a | -d | -l | -g | -t | -?} [-r <portname>] [-s <Servername>] [-u <Username>] [-w <password>] [-o {raw | lpr}] [-h <Hostaddress>] [-q <Queuename>] [-n <portnumber>] -m{e | d} [-i <SNMPindex>] [-y <communityname>] -2{e | -d}

Parameters, options and clauses

Option / clauseDescription
-a / -dCreate or delete a standard TCP/IP printer port.
-l / -g / -tList ports, display port configuration or change port settings.
-r <portname>Select the printer port to manage.
-s <Servername>Manage ports on a remote print server; omit to use the local computer.
-u <Username> -w <password>Provide credentials authorized to manage the target computer. Avoid exposing passwords in shell history.
-o {raw|lpr}Choose the TCP raw or TCP LPR protocol. Raw is the Windows higher-performance option.
-h <Hostaddress>Specify the printer host by IP address.
-q <Queuename>Specify a queue name for a TCP raw port.
-n <portnumber>Set the TCP raw port number; default is 9100.
-me / -mdEnable or disable SNMP.
-i <SNMPindex>Set the SNMP index when SNMP is enabled.
-y <communityname>Set the SNMP community name when SNMP is enabled.
-2e / -2dEnable or disable double spooling for TCP LPR ports.
-?Display command help.
-mMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
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