CODE: [Copy to clipboard]
::
::
@echo off
setlocal enabledelayedexpansion
del out*.txt 2>nul
set/a n=0,t=0
for /f "delims==mL tokens=5,7" %%i in (rez.txt) do (
if %%i gtr !n! set/a n=%%i
if %%j gtr !t! set/a t=%%j
)
::pause
echo The maxtime is: !n!ms.
echo The maxTTL time is: !t!.
echo +++++++++++++++++++++++++++++++++++++++++++++
ping -n 1 127.1>nul
echo 按时间从小到大排序中.........
for /l %%a in (0,1,!n!) do (
type rez.txt|find "=%%ams">>outa.txt
)
echo 排序完毕.
echo
:l
echo *********************************************
ping -n 1 127.1>nul
echo 按TTL时间从小到大排序中.....
for /l %%b in (1,1,!t!) do (
type rez.txt|findstr /e TTL=%%b>>outx.txt
)
echo 排序完毕.
CODE: [Copy to clipboard]
::
::修改版
::
@echo off
setlocal enabledelayedexpansion
del out*.txt 2>nul
set/a n=0,t=0,tmin=255
rem tmin是设置TTL排序的起始值,这样可以缩短一些时间;
rem 当然最好是将ttl的所有值放到一个列表中,让循环去检测执行.
rem n的最小值取0是可以适应的;
for /f "delims==mL tokens=5,7" %%i in (rez.txt) do (
if %%i gtr !n! set/a n=%%i
if %%j gtr !t! (set/a t=%%j) else (if %%j lss !tmin! set/a tmin=%%j)
)
echo The max_ms time is: !n!ms.
echo The minTTL time is: !tmin!, maxTTL time is: !t!.
echo +++++++++++++++++++++++++++++++++++++++++++++
ping -n 1 127.1>nul
echo 按ms时间从小到大排序中.........
for /l %%a in (0,1,!n!) do (
type rez.txt|find "=%%ams">>outa.txt
)
echo 排序完毕.
echo
echo *********************************************
ping -n 1 127.1>nul
echo 按TTL时间从小到大排序中.....
for /l %%b in (!tmin!,1,!t!) do (
type rez.txt|findstr /e TTL=%%b>>outx.txt
)
echo 排序完毕.