Windows – cmd needs “.exe” to run programs

command linewindows 7

Windows 7, cmd:

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

C:\>python.exe
(works)

C:\>bash
'bash' is not recognized as an internal or external command,
operable program or batch file.
C:\>bash.exe
(works)

etc…

Is there a way to make e.g. python.exe run when I type "python"?

Best Answer

  • Make sure .exe is in your %PATHEXT%:

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

    When you run python, Windows tries all extensions listed in that environment variable.

    C:\>set pathext=.exe;%pathext%
    
  • Related Question