I\'m trying to run a Python script from the command line as a command on Windows -- so no usage of \"Python\" or \".py\". If my script is named \"testing.py\", I am attempti
No, Windows does not support shebang lines.
The documentation you've linked relates to the py
launcher installed by Python, which can interpret various shebang lines to choose a Python version to run a script with.
setuptools
is able to generate wrapper .exes for your Python scripts, but it gets a little involved and already assumes you have a package with a setup.py
and so on.
Locally, if you really, really need this, you probably could add .py
to the PATHEXT environment variable, so the Windows command line looks up .py
s like it looks up .exe
s (and various others; the current modern default is .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
). However, this will naturally not scale for distributing apps, as all of your users would need to set that too.
My recommendation is to stick with just that boring old python testing.py
, really.