回复 1# cowards - @echo off
- echo ping获取time时间数值。如果小于100就一直循环判断,大于100就goto跳转
- echo 例如:来自 14.17.42.40 的回复: 字节=32 时间=76ms TTL=53
-
- for /f "tokens=2,4,6 delims==, " %%a in ('ping www.sohu.com -n 10 ^|find "平均"') do echo.最短延迟:%%a 最长延迟:%%b 平均延迟:%%c && pause
-
-
- :loop
-
- for /f "delims=" %%i in ('ping.exe "www.baidu.com"^|find/i "ttl="')do (
- for %%j in (%%i)do if /i not "%%j"=="ttl" (set "_time_ms=%%j"
- )else (
- call set "_time_ms_new=%%_time_ms:ms=%%"
- for /f "delims=" %%k in ('call echo,%%_time_ms_new%%')do (
- echo,原始值:%%i
- echo,提取的值:%%k
- if %%k gtr 100 goto :break
- goto :loop
-
- )
- )
- )
-
- :break
- pause
复制代码
|