如何在Windows上仅获取ping测试的回复行 [英] How to get only the reply line of a ping test on Windows

查看:164
本文介绍了如何在Windows上仅获取ping测试的回复行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,ping服务器IP地址时,我们会返回:

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

如何在Windows上的cmd.exe中使用一个简单的命令(只使用一个ping测试的回复行)作为回报?

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

也许最简单的方法是只显示第二行?应该如何做呢?因为我不知道如何在Windows上做。

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.

推荐答案


$ b

This may work more universally.

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

这篇关于如何在Windows上仅获取ping测试的回复行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆