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.中文
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.
List 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 / -md
Enable 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 / -2d
Enable or disable double spooling for TCP LPR ports.
-?
Display command help.
-m
Microsoft 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.