2015-11-01 228 views
1

的值,我想知道如何打印的值,而不是整个输出,为前:ping google.com -t如何打印输出从

输出 - 回复来自xxx.xxx.xxx.xxx:BYT = 32时间= 35 TTL = 52

,我想有:“时间= 35”只只或数字 - “35” 如果你知道如何帮助我,请帮助我:d 谢谢P.

回答

2

from command line

for /f "eol=P skip=2 tokens=5 delims= " %# in ('ping google.com -t -n 10') do @if "%#" neq "=" @if "%#" neq "in" @echo %# 

从批处理文件:

for /f "eol=P skip=2 tokens=5 delims= " %%# in ('ping google.com -t -n 10') do @if "%%#" neq "=" @if "%%#" neq "in" @echo %%# 

如果您没有设置-n 10你将不得不等待,直到for /f缓冲区已​​满。