System command

netstat command

Display network connections, listening ports and related statistics.

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

netstat [-a] [-b] [-e] [-n] [-o] [-p <Protocol>] [-q] [-r] [-s] [<interval>]

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

Examples

Show active and listening connections with numeric addresses and owning process IDs.

netstat -ano

Parameters, options and clauses

netstat options and parameter descriptions
Option / clauseDescription
-aShow all connections and listening ports.
-nShow addresses and ports numerically.
-oShow the owning process ID.
-bShow associated executables; may require elevation.
-r, -sShow routing information or per-protocol statistics.
-eMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
-pMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<Protocol>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
-qMicrosoft documents this switch; use the linked reference for accepted values, effects and version limits.
<interval>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
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