Computing.Net > Forums > Programming > XP Batch File

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

XP Batch File

Reply to Message Icon

Original Message
Name: Wire323
Date: December 11, 2006 at 08:22:46 Pacific
Subject: XP Batch File
OS: XP
CPU/Ram: P4 2.8Ghz, 1G ram
Model/Manufacturer: Dell
Comment:

I'm new to batch file scripting, and I was wondering if the following would be possible:

I have many routers that I manage. I want to be able automatically telnet to each one and run the same set of commands. Each one has a different IP address and password, which I can store in a text file for the script to use.

Is this possible? If it is, can someone steer me in the right direction?


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: December 12, 2006 at 01:42:18 Pacific
Reply: (edit)

I only have one router to experiment with. I tried to telnet to it at 192.168.1.1 and connect failed. I've enabled remote admin. Any suggestions to make this work so I can tinker with a script?


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: Shr0Om
Date: December 12, 2006 at 03:37:42 Pacific
Reply: (edit)

M2: Does your router support telnet interface? I think most "home" routers use a web interface only.


Wire323:
It is possible to make a batch script that connects via. telnet, but once you are connected, the script would halt as telnet is waiting for manual input, and the script will not continue before you have entered the commands and quit telnet.

But there is hope, i haven't tested it, but it seems you can simulate user input with a VB script:

http://www.vandyke.com/support/crt/...


Report Offensive Follow Up For Removal

Response Number 3
Name: tonysathre
Date: December 12, 2006 at 10:59:46 Pacific
Reply: (edit)

@echo off

Type the IP of the router you would like to manage:

set/p ip=

telnet %ip%

commands

...

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 4
Name: Wire323
Date: December 12, 2006 at 12:42:57 Pacific
Reply: (edit)

I can't get it to work. Let's assume the IP is 1.2.3.4, the username is admin, and the password is password. Is this what I would do?

@echo off
set/p ip=1.2.3.4
telnet %ip%
admin
password
other commands
logout

If so, it isn't working. What am I doing wrong?


Report Offensive Follow Up For Removal

Response Number 5
Name: Mechanix2Go
Date: December 12, 2006 at 19:19:35 Pacific
Reply: (edit)

Shroom,

You may be right.



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal


Response Number 6
Name: Shr0Om
Date: December 13, 2006 at 03:41:12 Pacific
Reply: (edit)

The /p switch is used when you want user input.

@echo off
set /p host=Enter ip address:
telnet -l username 192.168.1.1

But, this wont do you much good.
Try checking that VB script out.


Report Offensive Follow Up For Removal






Post Locked

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


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software