联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
::假设ping163来检测并且ping的格式跟我一下如下: (且为方便只ping一条) ::Pinging 163.com [220.181.29.154] with 32 bytes of data: ::Reply from 220.181.29.154: bytes=32 time=48ms TTL=52 ::Reply from 220.181.29.154: bytes=32 time=53ms TTL=52 ::Reply from 220.181.29.154: bytes=32 time=43ms TTL=52 ::Reply from 220.181.29.154: bytes=32 time=44ms TTL=52 set IP= set IPstr= set lping=0 :start for /f "tokens=7 delims== " %%i in ('ping 163.com -n 1 ^| find "Reply"') do set IPstr=%%i set IP=%IPstr:~0,-2% if not s%IP%==s goto :aaa set /a lping+=1 goto :judge :aaa if %IP% gtr 800 set /a lping+=1 ::10个ping值高过800就弹出窗口了 :judge if not %lping% gtr 10 goto :next ::注意把用户名改成当前已登录用户 start msg 用户名 网络较慢,请检查 goto :eof :next set IPstr= set IP= sleep 1 goto :start