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

后端 未结 7 1303
你的背包
你的背包 2021-02-04 12:01

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

Pinging  with 32 bytes of data:
Reply from  : bytes=32 time=151 TTL         


        
7条回答
  •  不思量自难忘°
    2021-02-04 12:26

    Well,

    ping -n 1 
    

    Will send only 1 ping request. And you should be able to find the reply line using none other than the FIND command.

    So, something like this:

    ping -n 1  | FIND "Reply"
    

    UPDATE

    I know the above works on an English, Windows 7 machine. I would assume that it would work for other localizations, but this may be an incorrect assumption.

    UPDATE 2

    This question seems to provide some insight. You may have to write the output of ping to a file (using the > output redirection pipe) and then use the commands in the answers to get only the second line.

提交回复
热议问题