Board logo

标题: [已解决]获取PING平均网络延时值 [打印本页]

作者: hackiller     时间: 2008-10-21 22:22    标题: [已解决]获取PING平均网络延时值

如ping 163.com
返回结果
Pinging 163.com [220.181.31.8] with 32 bytes of data:
Reply from 220.181.31.8: bytes=32 time=616ms TTL=246
Reply from 220.181.31.8: bytes=32 time=986ms TTL=246
Reply from 220.181.31.8: bytes=32 time=792ms TTL=246
Reply from 220.181.31.8: bytes=32 time=717ms TTL=246
Ping statistics for 220.181.31.8:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 616ms, Maximum = 986ms, Average = 777ms

想提取返回结果中的Average = 777ms
效果:
当前平均网络延时777毫秒
请问完整纯批处理代码怎么写 谢谢

[ Last edited by hackiller on 2008-10-21 at 23:13 ]
作者: HAT     时间: 2008-10-21 22:24
这个里面就是用的Average:自动获取最快速的QQ服务器
http://www.cn-dos.net/forum/viewthread.php?tid=40395
作者: hackiller     时间: 2008-10-21 22:36
SORRY 我不会改 可以帮我改一下不
作者: hackiller     时间: 2008-10-21 23:11
FOR /F "skip=9 tokens=8,*" %%i IN ('ping 163.com -n 2') DO SET TIME=%%j
set TIME=%TIME:ms=%
echo 当前平均网络延时%TIME%毫秒
乱搞的 勉强成功了
"skip=9 tokens=8,*" 和"skip=11 tokens=4 delims==" 搞不大清楚
我是从别的代码里改来的
作者: everest79     时间: 2008-10-22 13:25
for /f "tokens=3 delims=," %i in ('ping 192.168.1') do set %i
echo %Average %
作者: laotou1000     时间: 2009-10-9 11:13


  Quote:
Originally posted by everest79 at 2008-10-22 13:25:
for /f "tokens=3 delims=," %i in ('ping 192.168.1') do set %i
echo %Average %

为什么在我电脑上运行时一闪就没有了?