Run Python with the py Launcher on Windows
Start Python scripts and switch between installed Python versions using the built-in py.exe launcher.
01Command
$ py -3 script.py02What it does
The official Python installer ships a py.exe launcher in C:\Windows so "py" works in cmd and PowerShell even when python.exe is not on PATH. The version switch saves real pain on machines with multiple Pythons: py -3.11 script.py targets a specific version, and py -0p prints each installed version with its install path. Shebang-style comments at the top of a script (e.g. #! python3) let the launcher pick the interpreter automatically.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Using Python on WindowsEvidence: Documents the py.exe launcher: py -3 runs Python 3, py -0/-0p lists installed versions with paths, and shebang lines select interpreters.
Last verified: 2026-09-18 · Category: Developer
06Related solutions
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.