Discussion Locked

Automating Telnet.

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm trying to write a batch file in windows that will execute commands to a telnet session after I issued the command in the batch file to start Telnen.
So far I have not been able to send any commands to the Telnet session using a Batch file.
If anyone can please help me.

10 replies

by shmaltz

Sorry, but the URL doesn't work (even after removing spaces). You are a perl programmer good for you, who said I'm not. In my question I stated: a batch file in windows. Got it I know I can program it I have done it before. What I'm looking for issomething thats going to work on any windows (by any I mean, any windows mahcine that has by default telnet isntalled, Win9x WINNT WIN2000) machine without installing additional software. So, at the end it does make me think it is trivial.

by timthetoolman

Actually I said it ISNT trivial.

There is NO easy way to make a telnet session in, and then continue to read from a batch file. Thats what the thread was about.

You need to remove the space from the URL as per my comment below it. I tried it and it works fine.

Also, you can write a batch file that contains embedded perl script that calls itself with the "-x" option on the perl line.

...but being a competent perl programmer, I guess you knew that.

Good luck,
Tim.

by timthetoolman

Ah... on reading your comment again, I notice you're NOT a perl programmer... no matter... one of the answers in the thread describes the perl you'd use. I'm sure you could fix it to do what you wanted.

I wouldn't have mentioned perl if it hadn'tbeen one of the options offered in the thread.

Persist with the URL - that is if you want a resolution to your problem...

by timthetoolman

One last comment.... You mentioned you'd done it before.

Are you sure you're not thinking of scripting FTP? Thats certainly possible. Theres a script reading option off the command line.

Not so with telnet.

The only other possibility I can think of in the limited world of DOS is...

telnet < script.txt

but it doesn't work. I tried it for you.

By the way, I'm trying to help you so the least you could do is be polite!

by shmaltz

I know you are trying to help me. But you are not actualy helping me. I asked, and I repeated it in the comments, I'm looking for a solution for Windows without any additional programs installed on the computers. I am a Perl programmer, I have programmed this in perl, What I'm looking for is to do a batch file that will do it for me. Perl is not going to work on a computer unless you have the engine installed on that computer.
I'm sorry but the link does not work.

by shmaltz

I said I have done it before. I have done it in Perl scripting not in windows batch. Now I'm trying to do it Windows Batch.

by timthetoolman

Again... I only mentioned perl as its ONE of the options given in the thread. Your original question didn't mention anything about the need to run on "any old windows machine with no extra software"...

I didn't think I'd signed up for this site in the past, but I guess its possible - and I had the cookie needed for access...

Try going to the homepage...

http://www.winscriptingsolutions.com

Then you may or may not need to sign up...
Then do a search (in the search box) for

telnetscript

Its the first thread returned titled "automate telnet?"

There are other solutions given in the thread apart from perl. But there is no straight DOS one. From memory there is suggestion of a windows scripting host one, though (although it has limitations) but that may do what you want.

Take a read anyways. You may change your mind about how you attempt to tackle the problem.

As I said, I dont believe there is a pure DOS based solution to this and neither does anyone in the above forum.

If you come up with one, then I'd certainly like to see it!

Hope you get it in the end...
Tim.

This discussion is closed to new replies.