1

I have enabled the telnet client on my Windows 7 64-bit machine and if I open the start menu and launch cmd from there I can run telnet.

I normally use the keyboard shortcut Win-C, implemented by this AutoHotkey snippet to open a console.

#c::Run, C:\WINDOWS\system32\cmd.exe

For some strange reason when I try to run telnet in a console window opened this way I get

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Steve\Documents>telnet 'telnet' is not recognized as an internal or external command, operable program or batch file.

Running path in any console, regardless of how it was opened produces the same output.

Can anyone shed any light on why telnet might run in one console but not the other?

  • 1
    Get Process Exporer from Sysinternals and examine both processes' environments. See if there is any difference anywhere. – paradroid Apr 19 '12 at 15:34
  • I can see they differ. Not sure how to fix the problem but at least it makes sense now why the problem happens. – Steve Crane Apr 19 '12 at 21:39
  • 2
    If you edit your question with the differences you see (data or screenshots) somebody may be able to tell you. – paradroid Apr 19 '12 at 21:43
1

A code snippet would have made posting a solution far, far easier!

Your problem is the path command rulez still apply to DOS even when running under Windows.

Have a closer look at your path in each environment mentioned, and the location of the telnet program, and check whether the command processor will find the executable in each case. You should be able to specify the complete pathname of the telnet program name in AHK which should solve your problem.

Alternatively put a batch file called telnet.bat in your documents folder which calls the actual telnet program.

Don't forget in either case to pass telnet the command line input parameters, ie: /telnet.exe %0 %1, etc

  • Some good ideas but I ended up just using telnet from a virtual Linux machine. Even when I ran telnet on Windows it didn't work as the tutorial I was working through said it should. The Linux one did. – Steve Crane Jul 1 '12 at 20:12
  • Not sure what code snippet you were expecting, this is after all a question about running an application, not writing one. – Steve Crane Jul 1 '12 at 20:14
1

It looks like the solution to this other question may apply directly to your scenario: telnet not runnable.

A 32-bit shell may not be running the 64-bit Telnet client. Your AutoHotkey script does run CMD from the System32 directory.

Try running CMD directly from the Start menu. See if that gets different results. If not, try using the WHERE (both in the shell where Telnet works, and the shell where it doesn't), and report the PATH from both cases. That will greatly simplify any further troubleshooting.

1

Solution to this problem:

On a 64-bit Operating System telnet.exe is used from '%windir%\WinSXS' subdirectory and not from the '%windir%\System32' subdirectory due to the default environment settings.

To solve the problem select in the AHK compiler the 64-bit option from the list to compile the selected executable to run telnet.exe from within the compiled AHK executable, because telnet.exe is listed as a 64-bit process tab in the tasklist. Running the 32-bit telnet.exe from the '%windir%\System32' subdirectory will not run in a 64-bit Operating System. The 64-bit telnet.exe from the '%windir%\WinSXS' in compatibility mode will hang if operated from a 64-bit Operating System.

0

I gave up quickly on trying to work out what caused this problem as I had no pressing need to do so. I was able to execute telnet, just not in the way I initially tried. Even when I did run it I found it to be less useful than telnet in a virtual Linux machine. I last made much use of telnet (in Windows anyway) on XP and the telnet on Windows 7 seems to have taken a step backwards from that one.

-1

Update:

You should verify that telnet.exe is correctly installed.

On a Win7 64bit installation you can find it in a directory named similar to this one:

C:\Windows\winsxs\amd64_microsoft-windows-telnet-client_31bf3856ad364e35_6.1.7600.16385_none_1426830c3ebb712d

If it is not present, deinstall and reinstall it.

  • Perhaps you didn't understand my question. The first sentence says that I have enabled (installed if you will) the telnet client. – Steve Crane Jul 1 '12 at 14:34
  • I am sorry, even with your comment I had to read your question three times for finding the relevant part. If you mean installed the please say it. – Robert Jul 1 '12 at 16:19
  • I imagine if I meant installed I would have used the word. Out of interest I just Googled for "windows 7 telnet" and the first few hits use install or enable; one even talked about "how to use telnet on Windows 7". As the files are already installed on the computer I see the program needing to be enabled rather than installed, but would certainly have no problem understanding either. – Steve Crane Jul 1 '12 at 20:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.