How to get output of ping command without Ping statistics?
Asked Answered
B

2

6

For example, in Windows 7 output of command

ping -n 1 ::1

is following:

Pinging ::1 with 32 bytes of data:
Reply from ::1: time<1ms

Ping statistics for ::1:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Is it possible to get output without Ping statistics (without the last four lines in this case or without two lines in case if destination host is unreachable)?

Boatswain answered 12/6, 2015 at 10:8 Comment(2)
What are you using the output for?Bearded
for logging reachability of hostBoatswain
F
10

Maybe using this command:

ping -n 1 ::1 | find "string to search"
Forelock answered 12/6, 2015 at 10:19 Comment(1)
Yes! Of course! Thanks! It is better than expected: ping -n 1 ::1|find "Reply"Boatswain
D
1

The currently accepted answer would filter out 'Request timed out' errors. Instead, use findstr /B R, which only outputs lines that start with R:

ping -n 1 ::1 | findstr /B R
Deguzman answered 8/7, 2022 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.