Posted: Thu Nov 06, 2008 21:06 Post subject: (DD-WRT)Router reconnect Batch Script for Windows
Hi @ all fellow dd-wrt users :-)
here I want to provide a more interactive Windows Batch Script to reconnect a routers internet connection. With my ADSL ISP it worked well.
Code:
@ECHO OFF
REM Performs a reconnect of a routers internet connection based on a DD-WRT firmware using cURL especially
REM http://www.paehl.de/reconnect/
REM NOTE: User cannot contain whitespaces
REM NOTE: Password cannot contain whitespaces
REM Works with DD-WRT v23sp2 so far
SETLOCAL
SET IP=%1
SET USER=%2
SET /P PWD=Password:
curl "http://%USER%:%PWD%@%IP%/apply.cgi" -d "submit_button=Status_Router&submit_type=Disconnect_pppoe&change_action=gozila_cgi&action=Apply" > NUL
IF NOT %ERRORLEVEL% EQU 0 GOTO END
curl "http://%USER%:%PWD%@%IP%/apply.cgi" -d "submit_button=Status_Router&submit_type=Connect_pppoe&change_action=gozila_cgi&action=Apply" > NUL
:END
ENDLOCAL
SETUP:
Just save the above code to a BAT or CMD file respectively (e.g. ddwrtReconnect.cmd) somewhere in your path environment on your computer.
USAGE:
All you need to do is to give the IP-Address and the Username as commandline to the script (e.g. ddwrtReconnect 192.168.1.1 UserName). After that you will be asked for the Password so the script can execute the administrative reconnect command.
NOTE:
You need to have cURL installed and have it in the path environment on your computer.
Any feedback would be appreciated.
Thanks
Brathering
Last edited by Brathering on Sat Nov 29, 2008 17:10; edited 1 time in total
thanks brathering! This script works perfectly! Much appreciated!
EDIT: for those of you who are looking for cURL exe's, it's located here: http://curl.haxx.se/download.html. Just scroll down to the Packages section, look for your OS and download the related package in your OS section.