Sign in to follow this  
Followers 0
scriptjunkie

Help with Comspec and Telnet

2 posts in this topic

I wrote a simple telnet script:

#include <Constants.au3>

Run(@ComSpec & " /k telnet 10.0.0.1", "C:\")

In windows xp, no problems works fine.

My company upgraded to windows 7. The first time I ran the script I got an error:

'telnet' is not recognized as an internal or external command,
operable program or batch file.

Doing a quick google search I found that windows vista and windows 7 does not enable the telnet client by default. Followed the steps and enabled the telnet client.

Open control panel. 
Then go into programs. 
Then in programs and features there should be a part that says ‘turn windows features on or off ‘ .

Click ‘turn windows features on or off ‘ then on the list that appears simply check the box beside: Telnet Client. 
Then click ok.

Ok, so issue resolved. Now it works.

The next day I get in. My script is not working again. I check if the client telnet is enabled. Yes it is.

I opened a command prompt and typed "telnet". Ok that works. Run my script again. Error... "'telnet' is not recognized as an internal or external command". After the script runs it leaves the command prompt open, so I type telnet in this window. Same error. I open a new command prompt (cmd.exe at the run line) and type "telnet", that works with no problems.

What is so different with the run autoit command? and when I just type "cmd.exe" on the run line?

Any ideas?

Share this post


Link to post
Share on other sites



Scriptjunkie,

Why not avoid the hassle and use an open source alternative? Search for "Console telnet for win32" in your favorite search engine, and you can include their small binary (less than 350K including INI, KEYS and ICO files) along with your program. Console Telnet

If you still want to use the built-in telnet client, have you tried to run the program using the ShellExecute function?

Hope that helps!

Jose

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0