改进一下这个程序
@echo off
setlocal enabledelayedexpansion
set repeatNum=2
set repeatCount=0
set adslUser=057188825632
set adslPass=123456
set adslName=宽带连接
set total=121
:loop
set val=1
for /f "delims=" %%i in (c:\url.txt) do (
echo.
ping 127.1 -n 3 >nul 2>&1
set /a var+=1
echo 计数%total%次暂停3分钟并关闭TheWorld.exe,当前计数!var!
echo.
if !var! geq %total% (
ping 127.1 -n 30 >nul 2>&1
set var=0
taskkill /im TheWorld.exe /f >nul
) else (
echo %%i
echo.
start %%i
)
)
set /a repeatCount+=1
if !repeatCount! lss %repeatNum% (
rasdial "%adslName%" /disconnect
rem 请根据自己的网络情况自行调节延时的长短以确保能够能够获得新的IP
ping -n 10 127.1 >nul
rasdial "%adslName%" %adslUser% %adslPass%
goto :loop
)
pause>nul
希望改进的效果是:我循环二次c盘目录下的url文件,然后执行d盘目录下的url文件,循环二次后再返回执行c盘目录下的url文件,这样一直循环。
问题有点仓促,也不知道能不能做到的,在此先谢过了
[解决办法]
test.bat
@echo offsetlocal enabledelayedexpansionset adslUser=057188825632set adslPass=123456set adslName=宽带连接set total=121set loopC=0set loopD=0set repeatNum=2set var=0:loopCfor /f "delims=" %%i in (C:\url.txt) do ( echo. ping 127.1 -n 3 >nul 2>&1 set /a var+=1 echo 计数%total%次暂停3分钟并关闭TheWorld.exe,当前计数!var! echo. if !var! geq %total% ( ping 127.1 -n 30 >nul 2>&1 set var=0 taskkill /im TheWorld.exe /f >nul ) else ( echo %%i echo. start %%i ))set /a loopC+=1if !loopC! lss %repeatNum% ( rasdial "%adslName%" /disconnect rem 请根据自己的网络情况自行调节延时的长短以确保能够能够获得新的IP ping -n 10 127.1 >nul rasdial "%adslName%" %adslUser% %adslPass% goto :loopC) else ( goto :loopD):loopDfor /f "delims=" %%i in (D:\url.txt) do ( echo. ping 127.1 -n 3 >nul 2>&1 set /a var+=1 echo 计数%total%次暂停3分钟并关闭TheWorld.exe,当前计数!var! echo. if !var! geq %total% ( ping 127.1 -n 30 >nul 2>&1 set var=0 taskkill /im TheWorld.exe /f >nul ) else ( echo %%i echo. start %%i ))set /a loopD+=1if !loopD! lss %repeatNum% ( rasdial "%adslName%" /disconnect rem 请根据自己的网络情况自行调节延时的长短以确保能够能够获得新的IP ping -n 10 127.1 >nul rasdial "%adslName%" %adslUser% %adslPass% goto :loopD) else ( goto :loopC)pause>nul