3

Using the Windows 10 command prompt, I have to type .exe after pretty much any command to make it work. For example,

>ping google.com
'ping' is not recognized as an internal or external command,
operable program or batch file.

>ping.exe google.com
Pinging google.com [216.58.217.46] with 32 bytes of data:
Reply from 216.58.217.46: bytes=32 time=11ms TTL=55

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

>where.exe java
INFO: Could not find files for the given pattern(s).

>where.exe java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe

I am having problems with Android Studio running the SDK manager, and I suspect this is related. Also, it's annoying, and I wonder if it will probably break other scripts. I don't know exactly when this started happening, but can't think of any settings I've changed that would do this.

2 Answers 2

10

It's possible that your %PathExt% environment variable has garbage in it – it's how cmd.exe knows which file extensions it should try. Normally its contents should be:

C:\Users\Mantas>set pathext
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Use sysdm.cpl → Advanced → Environment Variables to check and fix it.

1
  • 3
    This was it! Specifically, I had a user PATHEXT environment variable that was overwriting my system PATHEXT variable. The system will merge a user PATH with a system PATH, but a user PATHEXT will overwrite a system PATHEXT. To solve the problem, I deleted my user PATHEXT (which I incorrectly made a while ago, thinking it would merge with the system PATHEXT).
    – mkasberg
    Commented May 22, 2016 at 19:51
0

I have just had this problem on Windows 7 and fixed it by reordering the paths in my %PATH%.

It looked like this:

C:\Program Files\Java\jre1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows

And I had to change it to this:

C:\Windows\system32;C:\Windows;C:\Program Files\Java\jre1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath

The system path needs to appear first. I suspect it was the JRE installer that messed this up.

EDIT: according to @DavidPostill (comments below) this solution is mere coincidence, and it must have been something else that changed that solved the problem I was having. I tried changing %PATH% back to how it was before, and the problem did not return, so he seems to be correct.

3
  • Your solution is coincidence. Changing the order of directories in the path makes no difference to a "not recognized as an internal or external command, operable program or batch file." error. By the way, you are missing C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\ from your path. The default path on Windows 7 is C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    – DavidPostill
    Commented Aug 13, 2016 at 7:24
  • @DavidPostill Thanks, I don't know what else could have changed. I literally had the error, changed %PATH%, and the error was gone. My instinct is not to delete this answer, just in case there was something going on that neither of us understands, but to leave these notes so people know it might not be good.
    – Oktalist
    Commented Aug 13, 2016 at 12:53
  • For the record, my real %PATH% is C:\Program Files\Java\jre1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Qt\5.6.0\5.6\msvc2015_64\bin;C:\Program Files (x86)\CMake\bin, the ones in the answer I trimmed down a bit for space.
    – Oktalist
    Commented Aug 13, 2016 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .