Making Python scripts run on Windows without specifying “.py” extension

前端 未结 4 1593
甜味超标
甜味超标 2020-12-01 05:52

I want to able to open a command prompt at the folder which contains a python script and just type in the script name without the .py and watch it run.

Following the

4条回答
  •  无人及你
    2020-12-01 06:11

    Modify the PATHEXT variable to include Python scripts. For example, here's mine:

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

    You can do this every time you open a command console, or just modify your user global environment variables so that every instance of cmd.exe will include it.

提交回复
热议问题