Continuous ping and traceroute on Windows
Windows comes with everything you need to start investigating a connection problem. Here's how to use the built-in tools, what each one tells you, and where they run out.
All of these run in Command Prompt or PowerShell: press the Windows
key, type cmd or powershell, and press Enter. None of them need administrator
rights.
Continuous ping: ping -t
A normal ping sends four requests and stops. Add -t and it keeps going until you
stop it:
ping -t 8.8.8.8
Each line shows a reply and its time, or "Request timed out" for a lost ping. Press
Ctrl+Break to see the totals so far without stopping, and Ctrl+C to stop
and see the final count of sent, received and lost. To send a fixed number instead, use
-n, for example ping -n 500 8.8.8.8.
Adding timestamps
ping -t doesn't record when each reply arrived, which is exactly what you need to
match a drop-out to the time it happened. This short loop for Windows PowerShell pings
once a second, adds the time to every line, and saves it all to a file on your desktop:
while ($true) {
$r = Test-Connection 8.8.8.8 -Count 1 -ErrorAction SilentlyContinue
$line = "{0:yyyy-MM-dd HH:mm:ss} {1}" -f (Get-Date), $(if ($r) { "$($r.ResponseTime) ms" } else { "timeout" })
$line
$line | Out-File -Append "$HOME\Desktop\ping-log.txt"
Start-Sleep -Seconds 1
}
Stop it with Ctrl+C. The log stays on your desktop.
One-off traceroute: tracert
tracert -d 8.8.8.8
This lists every hop on the way to the destination, with three timings for each. -d skips
looking up each router's name, which makes it much faster. It's a snapshot of a few seconds, so it shows
the route but rarely catches an intermittent problem. For what the hops mean, see
Network basics.
Loss at every hop: pathping
pathping -n 8.8.8.8
The most useful built-in tool, and the least known. It traces the route, then sends 100 pings to every hop and reports how many were lost at each one. It takes a while (about 25 seconds per hop by default), but the result shows loss per hop in one table. Read it with the rule from Which hop is causing packet loss?: loss that starts at a hop and carries on to the destination is real; loss at one hop that disappears further on isn't.
Where the built-in tools run out
They're good for a first look, but for a problem that comes and goes, you'll hit the limits quickly:
- One host at a time. You can't see whether your router, your provider and a website all dropped at the same moment, which is the thing that tells you where the problem is.
- Text, not graphs. Spotting a pattern in thousands of lines, such as "every evening at 7pm", is slow.
- Traces are snapshots. Neither
tracertnorpathpingwatches the route over hours, so a fault that comes and goes, or a route that changes, is easy to miss. - No jitter figure. You'd have to work it out yourself from the times.
BadHop does all of this continuously. Any number of hosts pinged side by side, as often as
every half-second, with live graphs of latency, jitter and loss; the route to each one traced
automatically, with loss and timings kept for every hop; and alerts when something goes wrong. It uses
the same Windows networking as ping and tracert, and doesn't need administrator
rights either. Download it free.
Back to all guides