@echo off
set num=0
setlocal enabledelayedexpansion
for /f "delims=" %%i in (Config.ini) do (
set /a num+=1
set str=%%i
if !num! equ 4 set adslpassword=!str:~9!
if !num! equ 5 set adsluser=!str:~9!
)
rem 设置名称,帐号,密码
set adslname=VPN连接
set retry=0
rem 断开连接
:redisconnect
Rasdial %adslname% /disconnect
rem 延时5秒,-n后面的5代表5秒,可以自己修改.
ping 10.254.21.1 -n 3
if %errorlevel%n NEQ 0 (
goto start_connect
)
set /a retry+=1
if %retry% GEQ 3 (
goto connect_exit
)
goto redisconnect
:start_connect
echo 宽带连接已断开......
set retry=0
rem 宽带连接
:reconnect
Rasdial %adslname% %adsluser% %adslpassword%
rem 延时10秒,-n后面的10代表10秒,可以自己修改.
ping 10.254.21.1 -n 3
if %errorlevel% EQU 0 (
goto connect_exit
)
set /a retry+=1
if %retry% LSS 3 (
goto reconnect
)
:connect_exit
TIMEOUT /T 3
@echo on
自动网络连接
猜你喜欢
转载自blog.csdn.net/haimian_baba/article/details/105118971
今日推荐
周排行