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

后端 未结 7 1305
你的背包
你的背包 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:27

    You can combine findstr command with the skip lines option of for:

    C:\>ping 127.0.0.1 | for /f "skip=3 tokens=*" %a in ('findstr Reply') do @echo %a
    

    Output is:

    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    

    Change %a to %%a if writing a batch file.

    0 讨论(0)
提交回复
热议问题