1

On one of our production server 2008 boxes, I cannot run executables from a CMD prompt without supplying the full filename, including the '.exe' extension. For example, when running "java" produced the usual "is not recognized as an internal or external command" message, I assumed I had borked the path and/or java_home variables. However, even navigating to the %java_home%\bin directory and typing "java" produced the same error. If I type "java.exe" instead, all works perfectly.

The problem does not only affect java.exe. Even Microsoft executables suffer the same problem -- ping fails, ping.exe works; ipconfig fails, ipconfig.exe works; manually created batch file 'test' only works when invoked explicitly as 'test.bat'.

Any bright ideas?

[edit] Awesome! The issue was a bad value in pathext -- someone had inadvertantly edited the PATHEXT system variable (prepending %java_home%\bin), when that edit should have been on the PATH variable.

Thanks!

1
  • 1
    Check your PATHEXT System Variable. By default they are: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    – Lewis
    Mar 10, 2011 at 15:46

2 Answers 2

2

OK, I'm going to chuck my hat in the ring and say your PATHEXT System Variable is hosed or non-existent on that system. Look closely in your environment variables for a duplicate PATHEXT entry too.

The default value of the PATHEXT System Variable should be:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

The bad news is that if the server booted up without this, you'll probably need to reboot to get the setting to take effect since it's a System Variable.

Did you remove a program from that box recently?

As per: http://vlaurie.com/computers2/Articles/environment.htm

The %PATHEXT% environment variable contains executable file extensions that do not have to be specified for any file in a directory given in the %PATH% variable. The extension .EXE is the most common. Thus the filename sol.exe need only be entered as sol in a command line. If files have the same name but different extensions, the operating system searches in the following order of precedence: .EXE, .COM, .BAT, and .CMD.

1
  • +1. I think a reboot is not needed as long as you use the proper dialog to set the variable and start a new CMD instance. Mar 10, 2011 at 15:59
0

Check the PATHEXT system variable.

It should show somthing like:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

1
  • Oops...missed the comment above. So yeah...what he said.
    – Rjcassara
    Mar 10, 2011 at 15:57

You must log in to answer this question.