Basically, I'd like to run a script (versus typing python program.py) or even have a shortcut that I could click on and start the program. Any ideas?
Try using a batch file (.bat).
Type in whatever commands you want to execute in the proper order, in notepad, such as:
python program.py
Save the file as iHateTyping.bat
Open the command prompt using Run
.
Go to the directory where you saved the file using cd
.
Type in:
iHateTyping.bat
& you're done.
I encourage you to read more about batch files in the link highlighted above.
From python.org:
On Windows systems, there is no notion of an “executable mode”. The Python installer automatically associates
.py
files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be.pyw
, in that case, the console window that normally appears is suppressed.
Also from python.org:
On Windows 2000, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter (
D:\Program Files\Python\python.exe "%1" %*
). This is enough to make scripts executable from the command prompt as‘foo.py’
. If you’d rather be able to execute the script by simple typing‘foo’
with no extension you need to add.py
to thePATHEXT
environment variable.