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

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

    Based on @wmz answer,

    (for /f "skip=3 tokens=*" %F in ('ping -n 1 ') do @if not defined _A @echo %F&set _A=0) &set "_A="
    

    is ok as a one-liner not language dependent.
    It will also give the result when no response is given (Timeout), where find and findstr will not.

提交回复
热议问题