@ECHO OFF ::VARIABLES ::First two words of a (succeful) ping response SET _ping_reply=Resposta de ::Name of the internet connection SET _conn_name=Oi 3G ::Time between checks (in seconds) SET _time=60 ::Directory to save history SET _hist_dir=D:\ik_hist.txt TITLE Inet Keeper ECHO --------------------------------------------------- ECHO Inet Keeper - Keeps you connected to the Internet ECHO ------------------------------------- by JackS ---- ECHO. ECHO - Ping reply start: "%_ping_reply%" ECHO - Internet connection name: "%_conn_name%" ECHO - History directory: "%_hist_dir%" ECHO - Time between checks: %_time% seconds ECHO. ECHO ------------------------------------------- GOTO :CHECKCONNECTION :CHECKCONNECTION ECHO @ @ ^| Checking connection, please wait... PING -n 1 www.google.com|find "%_ping_reply%" >NUL IF NOT ERRORLEVEL 1 goto :SUCCESS IF ERRORLEVEL 1 goto :TRYRECONNECT :SUCCESS ECHO U ^| You are connected to the internet. ECHO \_/ ^| Waiting %_time% seconds to check again... PING -n %_time% 127.0.0.1>nul ECHO -----+------------------------------------- GOTO :CHECKCONNECTION :TRYRECONNECT ECHO ----- >> "%_hist_dir%" date /T >> "%_hist_dir%" time /T >> "%_hist_dir%" ECHO Ping failure. Trying to reconnect. >> "%_hist_dir%" ECHO U ^| Ping failure! ECHO ~~~ ^| Trying to reconnect to %_conn_name%... RASDIAL "%_conn_name%" >> "%_hist_dir%" ECHO -----+------------------------------------- PING -n 5 127.0.0.1>nul GOTO :CHECKCONNECTION