|
|
|
|
#1 (permalink) |
|
New Member
![]() Join Date: May 2005
Posts: 10
|
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. |
|
|
|
|
|
#3 (permalink) |
|
New Member
![]() Join Date: May 2005
Posts: 10
|
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. |
|
|
|
|
|
#4 (permalink) |
|
Malware Destroyer
![]() Join Date: Apr 2005
Location: Hurricane Heaven... still
Posts: 1,095
|
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... |
|
|
|
|
|
#5 (permalink) |
|
New Member
![]() Join Date: May 2005
Posts: 10
|
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. |
|
|
|
|
|
#6 (permalink) |
|
Malware Destroyer
![]() Join Date: Apr 2005
Location: Hurricane Heaven... still
Posts: 1,095
|
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... |
|
|
|
|
|
#7 (permalink) |
|
New Member
![]() Join Date: May 2005
Posts: 10
|
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. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|