To run a Python script on Windows, open Terminal in the folder that holds your script, type py script.py (or python script.py), and press Enter. You can also double-click the file or run it from an editor. First install Python from python.org or the Microsoft Store. Python now recommends the Python install manager for Windows; the traditional full installer is being phased out from Python 3.14.
How to Run a Python Script in Windows
- Install Python if you have not. Type py –version in Terminal to check.
- Save your code as a file ending in .py, for example hello.py.
- Open File Explorer, go to the folder, right-click an empty area and choose Open in Terminal.
- Type py hello.py and press Enter.
- If py is not found, try python hello.py.
- To pass arguments, add them after the file name, for example py hello.py input.txt.

Ways to Run a Script
| Method | Notes |
|---|---|
| py script.py in Terminal | Uses the Python launcher; picks the right version |
| python script.py | Works when Python is on PATH |
| Double-click the .py file | Window closes when the script ends |
| IDLE, Run, Run Module (F5) | Comes with Python |
| Code editor Run button | Needs the Python extension |
Related: how to install pygame.
If the Script Won’t Start
- Python opens the Microsoft Store instead: turn off the python.exe app execution alias in Settings, Apps, Advanced app settings.
- Not recognized as a command: add Python to PATH or use py.
- Window closes too fast: run from Terminal instead of double-clicking.
Related: Split a word or string in Python.
Related: Fix the list assignment index out of range error in Python.
Related: Avoid TypeError when formatting strings in Python.
Related: Find your Python path in Windows.
More About Running Python Scripts
What is the difference between py and python?
py is the Windows launcher that finds installed versions. python runs whichever version is first on PATH.
How do I run a specific version?
Use py -3.13 script.py, for example.
Can I schedule a script?
Yes, with Task Scheduler.
Do I need admin rights?
No, not for running scripts.

Kermit Matthews runs Live2Tech from just outside Philadelphia. He is an IT specialist with over 20 years of experience, from a university help desk to small-business IT, IT management and his own consulting practice, and has written tech guides full time since 2020. Steps are checked against the current software on a real device or the maker’s official documentation. More about Kermit.