хм. зацикливание возможно. Поправил: 10 Раз пытается переподключиться
Код:
@(
setlocal enabledelayedexpansion
echo off
)
set "RightSubnet=31.135."
set "eth=dial-name"
set "iter=0"
set "cycles=10"
:rc
rasdial /DISCONNECT
rasdial "!eth!" log psw
echo.& echo wait 1 seconds & ping -w 3000 127.255.255.255 -n 1 > nul
for /f "tokens=2" %%i in (
'netsh int ipv4 show addresses "!eth!" ^| find /i "ip"'
) do set "ip=%%~i"
echo Current ip = !ip!
echo %ip% | find /i "!RightSubnet!" >nul && (
echo Success, the address is good
) || (
echo Warning, the aaddress does not match
if !iter! LSS !cycles! set /a "iter+=1" & GOTO :rc
)
echo.
if !iter! GEQ !cycles! (echo Fault. ) else (echo Success)
(echo on
endlocal
exit /b %error%
)