Export (0) Print
Expand All

Portqry Syntax

Updated: March 28, 2003

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Portqry Syntax

PortQry uses the following syntax:

Art Image portqry /n name [/p protocol] [/e || /r || /o endpoint(s)] [/l logfile] [/s] [/q] [/i]

Parameters

/n name
A required parameter used to specify the target system by host name or IP address. No embedded spaces are allowed in either. If PortQry attempts to resolve an IP address from a host name and cannot, then it reports an error and quits. If PortQry attempts to resolve a host name from an IP address and cannot, then it reports an error, but continues processing.

/p protocol
An optional parameter that specifies the type of port or protocol used to connect to the target port. Valid entries for protocol are tcp, udp, or both. The default is TCP. If you set the option to BOTH, you must also specify the port number by using the /e parameter. PortQry then sends queries to both the TCP and UDP port specified by the /e parameter.

/e port
An optional parameter. Use /e to query a single port within the valid range of 1-65535. The /e parameter cannot be used with /r or /o.

/r start port:end port
An optional parameter. Use /r to specify a range of port numbers to be queried in sequential order within the valid range of 1-65535. No spaces are allowed between the port numbers and the colon. The /r parameter cannot be used with /o or /e.

/o port,port,port...
An optional parameter. Use /o to query a series of port(s) in a specific order (not sequential), within the valid range of 1-65535. No spaces are allowed between port numbers and commas. The /o parameter cannot be used with /r or /e.

/l filename
An optional parameter. Use /l to copy the PortQry output to a text (log) file in the directory where you are running PortQry. Filename is the name (with extension) of the log file. If a log file with the same name already exists, PortQry prompts you to specify whether you want the existing file overwritten.

/s
An optional parameter. Use /s to request that Portqry wait longer for responses to UDP queries.

/q
An optional parameter. Use /q to suppress all output to the screen other than error messages. The /q parameter can be used with /e, but not with /o, /r, or /p with the BOTH option. For more information about errorlevel reporting, see Portqry Remarks.

/i
Bypasses default IP address-to-host-name lookup. This parameter is ignored unless an IP address is specified using the /n parameter. When an IP address is specified using /n, PortQry attempts to resolve the IP address to a host name. This process can be time consuming, particularly if the IP address cannot be successfully resolved. Specifying /i in this case allows you to bypass the default lookup, and instead, query the target port(s) immediately.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft