You might have more than one version of Python installed and the version IDLE is using is newer. To see what version of python you have you can type >python -V at a command line. If that version looks appropriate then you might need the full path to the file as the second parameter. E.g >python C:\myfile.py.
If you installed Python correctly there is always a chance that just typing the name of the script will run it with python. E.g. >myfile.py
I always find that adding C:\Python27 to the %PATH% variable and .PY to the %PATHEXT% variable makes running scripts easier. In this case just >myfile should work.
Edit after Update:
Typing just >python with no parameters opens python in 'interactive mode' which is different from the batch or scripting mode that your script is intended for. If executed with arguments the first argument is taken as the file path and further arguments are passed to the script in the sys.argv list.
PATHEXT
variable using zdan's accepted answer below, if you put Python scripts in a directory named by yourPATH
environment variable, there will be no need to supply a fully-qualified (or relative) path to run them anymore. Then Python scripts behave like any other installed program, and you can join them together in pipelines with other programs / cmdlets (e.g.get-clipboard | myscript.py
), and all that other goodness.:)
– TheDudeAbides Aug 28 '19 at 1:32