Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Powershell is there a better way to ping a host indefinitely besides doing something like this:

$max = [System.Int32]::MaxValue
ping host -count $max

The '%WINDIR%\System32\ping.exe' has a '-t' option to ping until Ctrl-C is pressed.

share|improve this question

2 Answers 2

up vote 2 down vote accepted
while (1) {
   ping host

This will ping indefinitely until you press Ctrl-C just like ping -t would.

share|improve this answer
while (1) { ping host -count 1000 } has the nice side effect of hiding most of the ping statistics. –  Luke Quinane Jul 24 '09 at 6:56

There is nothing at all wrong with John T's answer, but I will point out just for completeness sake that ping.exe is still there so this would work just fine in PS as well:

ping.exe host -t
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.