Skip to main content

Command referenceping

ping command (Windows / CMD)

WindowsCMDnetworkbeginner

What it does

Test reachability and measure response time with ICMP echo requests. Searches for the ping command cmd windows usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.

Test reachability and measure response time with ICMP echo requests.

Syntax

ping [/t] [/a] [/n count] [/w timeout] target_name

Common options

Flag / optionMeaning
/n countSend a fixed number of requests.
/tContinue until interrupted.
/w timeoutSet timeout in milliseconds.
/4Force IPv4.
/aResolve addresses to host names.

Practical examples

Default test

ping example.com

Sends four echo requests on Windows.

Ten probes

ping /n 10 8.8.8.8

Sends exactly ten requests.

Short timeout

ping /n 2 /w 1000 192.0.2.1

Waits at most one second per reply.

Linux ↔ Windows equivalent

Closest match: ping (Linux / bash / sh / zsh). Test IP reachability and measure round-trip response time.

Common mistakes

  • Treating ICMP filtering as proof that the target application is unavailable.
  • Using `/t` in automation without a termination plan.

FAQ

What does ping do in Command Prompt?

Test reachability and measure response time with ICMP echo requests.

How do I run ping in CMD?

Open Command Prompt and follow `ping [/t] [/a] [/n count] [/w timeout] target_name`; quote paths containing spaces.

What is a practical ping example in CMD?

Try `ping example.com` — Sends four echo requests on Windows.

Can ping be used in a batch file?

Yes. Check its exit code and escape CMD metacharacters when input is variable.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.