- @echo off&setlocal enabledelayedexpansion
- set "ip_address=[59.33.105.53]"
- rem 设置初始IP;
- :loop
- set /a packets+=1
- for /f "delims=*" %%i in ('ping -n 1 guoxin006.free.ezvpn.cn^|findstr "Pinging Reply Request" ') do (
- call :%%i
- )
- goto :loop
- :Pinging
- rem 获取对应DNS的IP地址
- if not %ip_address%==%2 echo;[IP] %time% ip_address change to %2>>log.txt
- set "ip_address=%2"
- goto :eof
- :Reply
- rem 获取延迟时间;
- set "tm=%6"
- set tm=!tm:~0,-2!
- echo !tm!
- if !tm! geq 500 echo;[Delay] %time% Approximate round trip time=%6>>log.txt
- goto :eof
- :Request
- rem 记录丢包;
- set /a loss+=1
- set /a _loss+=1
- set /a lp= loss*100 / packets
- if !_loss! geq 5 (
- set /a _loss=0
- echo;[Packets] %time% Packets: Sent = !packets!, Received = !packets!, Lost = !loss! [!lp!%% loss]>>log.txt
- )
- goto :eof
复制代码
修改过的
[ 本帖最后由 caruko 于 2010-7-7 13:34 编辑 ] |