How to get only the reply line of a ping test on Windows

mastermind picture mastermind · Sep 7, 2012 · Viewed 55.7k times · Source

Usually, when pinging a server IP address we have this in return:

Pinging <IP address> with 32 bytes of data:
Reply from <ip> : bytes=32 time=151 TTL=121
Reply from <ip> : bytes=32 time=151 TTL=121
Reply from <ip> : bytes=32 time=151 TTL=121
Reply from <ip> : bytes=32 time=151 TTL=121

Ping statistics for <IP address>:
packets: sent = 4, Received = 4, lost = 0 (0% loss),
Approximate round trip times in milli-secounds:
Minimum = 151ms, Maximum = 151 ms, Average = 151 ms

How do I get only the following line (only the reply line of one ping test) in return by a simple command in cmd.exe on Windows (whatever Windows language used)?

Reply from <IP address> : bytes=32 time=151 TTL=121

Maybe the simplest way is to display only the second line? How should this be done? Because I don't know how to do it on Windows.

Answer

foxidrive picture foxidrive · May 27, 2013

This may work more universally.

ping -n 1 <hostname/IP> | FIND "TTL="