Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to create an automated script for my coworkers that will allow them to reboot a Wireless Access Point running DD-WRT firmware v23 via telnet with a bat script. I'm somewhat new to scripts, but I've made a few and I know the problem is that the scripts will only pass commands for the command prompt, but won't in any programs that I open within the command prompt.
I have:
telnet <IP address>
root
password
rebootObviously that's not flying and if you're reading this you know that the telnet command is the only one passed through. Can anyone tell me how to push the username and password as well as the reboot command through? Or if it's even possible.
I have googled it and looked through the posts, not finding anything that would help me.

I doubt that it's possible with a batch script, but IVO might prove me wrong.
You really should do this with a proper programming language, such as Perl or Python or VB.

I don't really know any programming languages. I have a VERY basic knowledge of C++ but that's pretty much the extent. I was just checking to see if I was missing something or if someone knew of a simple quick way to do it.

You are right FishMonger, just a note: that is not possible due to the behavior of MS telnet command not allowing to be scripted at all.
A way to solve baer3328's problem without any programming may be to download TST10.exe tiny and free tool

The native scripting alternative would be to use VBScript, with its SendKeys function, to pass data on to MS' Telnet.

I've had the same problem "how to pass commands to telnet with a batch script" my solution was using php. To start the script execute it from example.bat.. of cource you have to download php first and configure the script to your needs.
-[example.php]--------
<?php
$errno = false;
$error = false;
$timeout = 30;
$yourip = "127.0.0.1";
$yourport = "12345";
$fp = fsockopen($yourip, $yourport, $errno, $error, $timeout);
fputs($fp,"root\r");
sleep(1);
fputs($fp,"password\r");
sleep(1);
fputs($fp,"reboot\r");
sleep(1);
fclose($fp);
?>
-----------------------[example.bat]--------
@echo off
echo Restarting server...
c:\php\php.exe example.php
----------------------

![]() |
Gcc installed but invisib...
|
Set a variable to the run...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |