如何在没有Ping统计信息的情况下获取ping命令的输出?

5
例如,在 Windows 7 中执行命令的输出:
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

是否有可能在没有Ping统计信息的情况下获得输出(在这种情况下没有最后四行或在目标主机不可达的情况下没有两行)?


您将使用输出结果做什么? - Roger Lipscombe
记录主机可达性的日志 - valeryan
2个回答

9
也许可以使用这个命令:
ping -n 1 ::1 | find "string to search"

2
是的!当然!谢谢!比预期的要好:ping -n 1 ::1|find "Reply" - valeryan

1
目前被接受的答案会过滤掉“请求超时”的错误。相反,使用 findstr /B R 命令,它只输出以 R 开头的行:
ping -n 1 ::1 | findstr /B R

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接