Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet help - batch files

Status
Not open for further replies.

lazyrunner50

Programmer
Joined
Jul 30, 2004
Messages
63
Location
US
Hey. Not sure if this is the right place to ask this, but I am trying to create a batch script that will open two windows (on an XP machine), log on to two Unix boxes using telnet, navigate to a directory and run a script I have created.

I know I can create a cron to run these scripts, but they require user input, so I would like to create a batch file that I can click on which will do the above steps.

I have looked all over the web, but can't find how to do it. I can find a lot of info on how to create batch scripts, but none of them mention how to automate the input of something like a login.

I would like to do something like this (syntax is incorrect since I don't really know how to create a batch file):

ECHO theUserName, thePassword | telnet theServer -->I am trying to pass the username and password to telnet, so it can login.

cd ~/myDir
./myScript
exit

ECHO theUserName, thePassword | telnet theSecondServer

cd ~/mySecondDir
./mySecondScript
exit

Is this possible?


 
You can still use cron and create your script to mimic user interaction with:

scripttorun << EOF
input1
input2
EOF

This does away with the need for a batch file. Will this suit you or have I misunderstood?
 
What you need is something other than MS telnet, which as far as I know, can't be used that way.

Try installing cygwin ( and you get the unix ssh and rsh on windows which should work soo much better.

Also ssh will remove the huge security hole of plaintext usernames and passwords on your network.

Matthew

The Universe: God's novelty screensaver?
 
Ken, thanks for the advice, but my scripts require the user to be present. I could probably program around this, but to do so would be way out of my level of expertise (I just learned how to write unix scripts a couple weeks ago).

Mattaw, we are also using Hummingbird Exceed to do stuff on Unix. I just started working here about two months ago, and never learned how to use Exceed since my system had some problems with it when I first came here. As I have been able to do all my work using telnet, I have not bothered learning. If there is some functionality I am missing out on, I will learn how to use it though at this point I have seen no advantage.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top