SHOW:
|
|
- or go back to the newest paste.
| 1 | @ECHO OFF | |
| 2 | ||
| 3 | ::VARIABLES | |
| 4 | ||
| 5 | ::First two words of a (succeful) ping response | |
| 6 | SET _ping_reply=Resposta de | |
| 7 | ||
| 8 | ::Name of the internet connection | |
| 9 | SET _conn_name=Oi 3G | |
| 10 | ||
| 11 | ::Time between checks (in seconds) | |
| 12 | SET _time=60 | |
| 13 | ||
| 14 | ::Directory to save history | |
| 15 | SET _hist_dir=D:\ik_hist.txt | |
| 16 | ||
| 17 | TITLE Inet Keeper | |
| 18 | ||
| 19 | ECHO --------------------------------------------------- | |
| 20 | ECHO Inet Keeper - Keeps you connected to the Internet | |
| 21 | ECHO ------------------------------------- by JackS ---- | |
| 22 | ECHO. | |
| 23 | ECHO - Ping reply start: "%_ping_reply%" | |
| 24 | ECHO - Internet connection name: "%_conn_name%" | |
| 25 | ECHO - History directory: "%_hist_dir%" | |
| 26 | ECHO - Time between checks: %_time% seconds | |
| 27 | ECHO. | |
| 28 | ECHO ------------------------------------------- | |
| 29 | ||
| 30 | GOTO :CHECKCONNECTION | |
| 31 | ||
| 32 | :CHECKCONNECTION | |
| 33 | ECHO @ @ ^| Checking connection, please wait... | |
| 34 | PING -n 1 www.google.com|find "%_ping_reply%" >NUL | |
| 35 | IF NOT ERRORLEVEL 1 goto :SUCCESS | |
| 36 | IF ERRORLEVEL 1 goto :TRYRECONNECT | |
| 37 | ||
| 38 | :SUCCESS | |
| 39 | ECHO U ^| You are connected to the internet. | |
| 40 | ECHO \_/ ^| Waiting %_time% seconds to check again... | |
| 41 | PING -n %_time% 127.0.0.1>nul | |
| 42 | ECHO -----+------------------------------------- | |
| 43 | GOTO :CHECKCONNECTION | |
| 44 | ||
| 45 | :TRYRECONNECT | |
| 46 | ECHO ----- >> "%_hist_dir%" | |
| 47 | date /T >> "%_hist_dir%" | |
| 48 | time /T >> "%_hist_dir%" | |
| 49 | ECHO Ping failure. Trying to reconnect. >> "%_hist_dir%" | |
| 50 | ECHO U ^| Ping failure! | |
| 51 | ECHO ~~~ ^| Trying to reconnect to %_conn_name%... | |
| 52 | RASDIAL "%_conn_name%" >> "%_hist_dir%" | |
| 53 | ECHO -----+------------------------------------- | |
| 54 | PING -n 5 127.0.0.1>nul | |
| 55 | GOTO :CHECKCONNECTION |