System command

ping command

Send ICMP echo requests to test network reachability.

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

ping [/t] [/a] [/n <count>] [/l <size>] [/f] [/I <TTL>] [/v <TOS>] [/r <count>] [/s <count>] [{/j <hostlist> | /k <hostlist>}] [/w <timeout>] [/R] [/S <Srcaddr>] [/4] [/6] <targetname>

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

Examples

Example usage for ping.

ping -n 4 example.com

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

ping /n 4 /w 1000 example.com

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

ping /n 10 /l 1000 10.0.99.221

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

ping /r 4 10.0.99.221

Parameters, options and clauses

Option / clauseDescription
/tSend echo requests continuously until interrupted; Ctrl+Break displays statistics and Ctrl+C exits.
/aResolve the destination IP address to a host name when possible.
/n <count>Set the number of echo requests; the default is 4.
/l <size>Set the data field length in bytes; the default is 32 and the maximum is 65,500.
/fSet the IPv4 Don't Fragment flag to troubleshoot path MTU issues.
/I <TTL>Set the IPv4 Time to Live value (0–255).
/v <TOS>Set the IPv4 Type of Service value (0–255).
/r <count>Record the route for IPv4; count is 1–9 hops.
/s <count>Record arrival timestamps; count is 1–4 and is required for link-local destinations.
/j <hostlist>Use IPv4 loose source routing through up to nine intermediate addresses.
/k <hostlist>Use IPv4 strict source routing through up to nine directly reachable intermediate addresses.
/w <timeout>Set the reply wait time in milliseconds; the default is 4000.
/RTrace the round-trip path (IPv6 only).
/S <Srcaddr>Set the source address (IPv6 only).
/4Use IPv4 when the destination is specified by name.
/6Use IPv6 when the destination is specified by name.
<targetname>Set the destination host name or IP address.
/?Display command help or the supported command-line usage.
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