How do I have to configure so that I don’t have to type python script.py but simply script.py in CMD on Windows?
I added my python directory to %PATH% that contains python.exe but still scripts are not run correctly.
I tried it with django-admin.py Running django-admin.py startproject mysite gives me Using python in front of it processes the command correctly.
Type 'django-admin.py help <subcommand>' for help on a specific subcommand.
What’s the problem here?
Or whatever the relevant path is – you can also set command line args using ftype.
In order to make a command recognized without having to give the suffix (
.py), similar to how it works for.exefiles, add.pyto the semi-colon separated list of the (global)PATHEXTvariable.ETA 2017-07-27
Seems like this is still getting eyeballs, wanted to elevate a useful comment for Win10 users (from @shadowrunner):
For me to get it work under Win10 the actual command was (note the placement of the quotes):
ETA 2019-02-01
Talk about evergreen!
First of all, if you’re newly installing Python, I highly recommend reviewing the answer by @NunoAndré .
Secondly, to clarify something from a recent comment, please note: you must do both parts (
assocandftype), or use a pre-existing association label in theftypecommand.By default, at least for Python 3.7 under Windows 8.1, the association for
.pyisPython.File, so performing theftypecommand I wrote above will not work correctly unless the association is first changed. Or you can just useftypeand give the default association instead. Up to you.