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?

Steve Crane
  • 2,580

5 Answers5

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.

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

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.

TOOGAM
  • 16,486
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.

Steve Crane
  • 2,580
-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.

Robert
  • 8,055