cmd需要“.exe”来运行程序

frn*_*nhr 3 windows-7 command-line

Windows 7,命令:

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)
Run Code Online (Sandbox Code Playgroud)

等等...

当我输入“python”时,有没有办法让例如 python.exe 运行?

use*_*686 7

确保.exe在您的%PATHEXT%

C:\>set pathext
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.py;.pl
Run Code Online (Sandbox Code Playgroud)

当您运行 时python,Windows 会尝试该环境变量中列出的所有扩展。

C:\>set pathext=.exe;%pathext%
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

765 次

最近记录:

14 年,3 月 前