ComputerForum.com ComputerForum.com  

Go Back   Computer Forum > General Chat > General Computer Chat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-16-2005, 05:35 PM   #1 (permalink)
New Member
 
Join Date: May 2005
Posts: 10
Default Need Help with DOS batch file ..

Hi I am writing a batch file to automatically run some commands by telnetting to a network device. Everything goes fine until the device asks for input from the user.

E.g "Press any key to continue .. "
Or
"Press enter to continue .. "

etc

The program then waits for the user input.

So I am forced to manually press the keyboard in order for the batch file to continue.

What I want to know is:

How do I simulate the "Enter" key press in my batch program?


P.S: I did googling today on this subject but they all recommend using the "CON" command with fc command. I am running windows 2000 and my DOS does not support the "CON" command.


Thanks for all the help in advance.
arul20 is offline   Reply With Quote


Old 05-16-2005, 08:17 PM   #2 (permalink)
Malware Destroyer
 
Byteman's Avatar
 
Join Date: Apr 2005
Location: Hurricane Heaven... still
Posts: 1,095
Default

Just take the "pause" statement out of the batch. Or tell us what command is being used that asks for input.
__________________
Don't byte off more than you can chew...
Byteman is offline   Reply With Quote
Old 05-17-2005, 04:08 AM   #3 (permalink)
New Member
 
Join Date: May 2005
Posts: 10
Default

Thanks for the prompt reply Byteman.

I did not have any pause command in my batch file.

The device I am tenetting to (similar to a router) asks me to "type <enter> to proceed"

I have to type it myself as I do not know how to make the batch file simulate the <enter> key being pressed.


That is the problem.

I want to know how to output 'carriage return' or 'enter' using the batch file.

Thanks for any help you guys.
arul20 is offline   Reply With Quote
Old 05-17-2005, 03:33 PM   #4 (permalink)
Malware Destroyer
 
Byteman's Avatar
 
Join Date: Apr 2005
Location: Hurricane Heaven... still
Posts: 1,095
Default

that's a toughy, don't know if it's possible, haven't tried. Here's a link to all telnet commands. I would think if you can start a telnet session from a cmd prompt you would be able to type the telnet "enter" command in as well... (just a guess)
__________________
Don't byte off more than you can chew...
Byteman is offline   Reply With Quote
Old 05-18-2005, 03:40 AM   #5 (permalink)
New Member
 
Join Date: May 2005
Posts: 10
Default

Byteman,

I have about 20 network devices to manage.

Whenever there is some common change in setting, I have to log on to each and every device and reconfigure.

What I am trying to do is (cos i'm lazy), I want to create a script to automatically log in to a device and execute commands and then log off and login to the next device .. etc .. all auto.

So using batch file, I am able to start telnet. BUT as I learnt over the past few days, DOS is not optimised for interfacing with devices. Thus I cannot execute telnet commands.

So I also tried Hyperterminal. You can prepare text files with the necessary commands before hand and after logging in to a device, let the file run. It is WAY faster than typing by hand all your usual commands.

However, I still have to create a new connection each time. I want to automate that too.

Currently I am researching telnet clients with scripting facility. CRT is popular in my office, however it has limited scripting ability. Then I found TN 3270 yesterday. It seems to be meeting my expectations, but I haven't wrote the script yet.

I'll welcome any suggestions. Thanks.
arul20 is offline   Reply With Quote


Old 05-18-2005, 03:11 PM   #6 (permalink)
Malware Destroyer
 
Byteman's Avatar
 
Join Date: Apr 2005
Location: Hurricane Heaven... still
Posts: 1,095
Default

do you have servers that these machines authenticate too? Logon scripts would be the way to go in that case. If you don't, then your guess is a good as mine, haven't done much in what your'e trying to accomplish the way your'e trying to accomplish it.
__________________
Don't byte off more than you can chew...
Byteman is offline   Reply With Quote
Old 05-26-2005, 10:52 AM   #7 (permalink)
New Member
 
Join Date: May 2005
Posts: 10
Default

Hi guys .. worked on it yesterday and today and it works.
I used three files. One Batch file, two script files for the telnet client
Thanks for all the help ..


::How it works:
::
:: .Batch file is run
:: .Batch File runs TN3270
:: .Opens Telnet connection to one address and calls a script (passwords.txt)
::
:: .Passwords.txt contains individual commands for each connection
:: Besides password, other specific commands such as banner can be specified here
:: .TN3270 runs passwords.txt
:: .looks up the list of passwords and logs in to the open connection
:: .calls the 'common commands script' -> cmds.txt
::
:: .Cmds.txt contains the common commands to be executed for ALL the devices
:: .TN3270 executes the commands found in cmds.txt
:: .execution is passed back to passwords.txt which exits TN3270
:: .excution is passed back to batch file
::
:: .Batch file opens the second connection using TN3270
:: .The process is repeated
:: .When all devices have been contacted, the batch file closes DOS window.
arul20 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:00 AM.


Powered by: vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.