Windows Ping should return only the response values of the packages

1

I am making a script as a ping command and I want to get only the response from packets sent and received, so far I can only put the ping media using this variable:

for /f "tokens=* delims= " %%i in ('ping -n 4 172.16.7.144^|find "ms"') do set "tempo=%%i"
echo.%tempo%

I want one now that only shows me the packets sent and received.

    
asked by anonymous 01.12.2014 / 21:00

1 answer

1

I ran your command in cmd and I changed the find to findstr as below.

for /f "tokens=* delims= " %i in ('ping -n 4 172.16.7.144 ^| findstr /i "pacotes"') do set "tempo=%i"  

The result that came out here was exactly what follows.

set "tempo=Pacotes: Enviados = 4, Recebidos = 0, Perdidos = 4 (100% de"

Then I executed echo %tempo% and the result was this one below.

Pacotes: Enviados = 4, Recebidos = 0, Perdidos = 4 (100% de

The line then dies from , but from what you reported was that information you wanted right?

    
02.12.2014 / 22:43