(DD-WRT)Router reconnect Batch Script for Windows

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
Brathering
DD-WRT Novice


Joined: 07 Nov 2007
Posts: 15

PostPosted: Thu Nov 06, 2008 21:06    Post subject: (DD-WRT)Router reconnect Batch Script for Windows Reply with quote
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
Sponsor
atomicrabbit
DD-WRT Novice


Joined: 27 Nov 2008
Posts: 1

PostPosted: Thu Nov 27, 2008 18:26    Post subject: Reply with quote
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.
Brathering
DD-WRT Novice


Joined: 07 Nov 2007
Posts: 15

PostPosted: Sat Nov 29, 2008 17:15    Post subject: Reply with quote
I added a setup instruction and an usage example to my initial post.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum