Quick Setup
Get up and running with Windows Python Launcher in three simple steps:Download the Launcher
Copy the
PythonLauncher.bat file to your Python project’s root directory (where your main Python file and requirements.txt are located).Run the Launcher
Double-click
PythonLauncher.bat to launch your project.The launcher will:- ✓ Detect your Python installation
- ✓ Create a virtual environment (first run only)
- ✓ Install dependencies from
requirements.txt(first run only) - ✓ Run your Python script
The default configuration works for most projects. If your main file is named
run.py, main.py, or app.py, the launcher will find it automatically.Basic Usage Examples
Running Your Project
Default Behavior
Default Behavior
Simply double-click
PythonLauncher.bat. The launcher searches for entry points in this order:run.pymain.pyapp.py
Drag-and-Drop Execution
Drag-and-Drop Execution
Drag any
.py file onto PythonLauncher.bat to run that specific file.Command-Line Arguments
Command-Line Arguments
Enable argument passing to send parameters to your Python script:Then run from command prompt:Your Python script receives
PythonLauncher.bat
--config production --debug as arguments.First Run Experience
On the first run, you’ll see output similar to this:Subsequent Runs
After the first run, startup is nearly instant:Common Configuration
EditPythonLauncher.bat to customize behavior. Here are the most common configurations:
Configuration Reference
All configuration is done through variables at the top ofPythonLauncher.bat:
Python Settings
| Variable | Default | Description |
|---|---|---|
pythonversion | 3.11 | Python version to use with the py launcher. Ignored if pythondir is not py or py.exe |
pythondir | py | Path or command for Python executable. Use %cd%\path\to\python.exe for relative paths |
The
py launcher is the recommended option. It comes with Python 3.3+ and handles version selection automatically.Entry Point Detection
| Variable | Default | Description |
|---|---|---|
initialfiles | "run.py" "main.py" "app.py" | List of files to search for. First match is executed. Follow the quote structure to add more |
server.py, then app.py:
Virtual Environment
| Variable | Default | Description |
|---|---|---|
usevenv | 1 | Create and use a virtual environment (1 = enabled, 0 = disabled) |
venvname | pyvenv | Name of the virtual environment directory |
installrequirementsfile | 1 | Install requirements.txt when creating venv (1 = enabled, 0 = disabled) |
requirementsfile | requirements.txt | Path to the requirements file |
Window Behavior
| Variable | Default | Description |
|---|---|---|
windowname | Python | Title displayed in the command prompt window |
minimizedcmd | 0 | Start command prompt minimized (1 = yes, 0 = no) |
autoclosecmd | 0 | Close window when Python script finishes (1 = yes, 0 = no) |
Advanced Options
| Variable | Default | Description |
|---|---|---|
passarguments | 0 | Pass command-line arguments to Python script (1 = yes, 0 = no). Disables drag-and-drop! |
alertifpynotinstalled | 1 | Alert and open Python download page if not installed (1 = yes, 0 = no) |
Troubleshooting
Python Not Found
Python Not Found
Symptom: Launcher exits immediately or shows “Python is not recognized”Solution:
- Check if Python is installed: Open Command Prompt and run
py -V - If not installed, run the launcher with
alertifpynotinstalled=1to automatically open the download page - Alternatively, download Python from python.org/downloads
- During installation, check “Add Python to PATH”
Wrong Python Version
Wrong Python Version
Symptom: The launcher uses a different Python version than expectedSolution:
Update the Verify available versions:
pythonversion variable:Virtual Environment Already Exists
Virtual Environment Already Exists
Symptom: Dependencies aren’t updating after modifying
requirements.txtSolution:
The launcher only installs dependencies when creating the venv. To update:- Delete the virtual environment folder (default:
pyvenv) - Run the launcher again to recreate it with new dependencies
No Entry Point Found
No Entry Point Found
Symptom: Launcher opens a Python shell instead of running your scriptSolution:
Your main file name doesn’t match the default list. Either:
- Rename your file to
run.py,main.py, orapp.py - Update
initialfilesin the launcher:
Drag-and-Drop Not Working
Drag-and-Drop Not Working
Symptom: Dragging a You can’t use both features simultaneously. Choose one based on your needs.
.py file onto the launcher doesn’t run itSolution:
Check if argument passing is enabled:Next Steps
Configuration Guide
Learn about all configuration options in detail
Examples
See real-world usage examples and templates
Usage Guide
Learn different ways to run your Python scripts
Troubleshooting
Solutions to common problems
Need Help? Check the Introduction for an overview of features, or dive into the Configuration Guide for detailed customization options.