Running Methods
There are three primary ways to run Python scripts with the launcher:1. Double-Click Execution
The simplest method is to double-click thePythonLauncher.bat file. The launcher will automatically:
Create virtual environment (if enabled)
Set up a virtual environment based on the
usevenv configurationBy default, the launcher looks for these files in order:
run.py, main.py, app.py. It will run the first one it finds.PythonLauncher.bat, it will:
- Create the
pyvenvvirtual environment (first run only) - Install dependencies from
requirements.txt(first run only) - Run
main.py
2. Drag and Drop Execution
You can drag and drop any Python file onto the launcher to run it directly. How it works:
Command prompt example:
3. Command Line with Arguments
Whenpassarguments=1, you can run the launcher from the command line with arguments that will be passed to your Python script.
Configuration:
- Find and run the first matching initial file (e.g.,
run.py) - Pass
--debug --config=productionto the Python script
Execution Behavior
Window Management
The launcher provides options to control the command prompt window: Minimized Execution:No Initial File Found
If no initial file is found, the launcher will:- Open a Python interactive shell (REPL) if
passarguments=0 - Open a Python interactive shell in the configured environment if
passarguments=1but no initial files exist
Virtual Environment Integration
When running scripts, the launcher automatically:- Activates the virtual environment (if
usevenv=1) - Runs your script within that environment
- Keeps the window open for you to see output (unless
autoclosecmd=1)
/k flag keeps the command prompt open after execution, allowing you to see errors and output.
Python Version Selection
The launcher respects your Python version configuration:py) with the -3.11 flag to target Python 3.11 specifically.
Alternative - Portable Python:
Quick Reference
| Method | Command | Requirements |
|---|---|---|
| Double-click | Run PythonLauncher.bat | Initial file must exist |
| Drag and drop | Drag .py file onto launcher | passarguments=0 |
| With arguments | PythonLauncher.bat --arg1 --arg2 | passarguments=1 |
| Direct file | PythonLauncher.bat script.py | passarguments=0 |
The launcher always checks for Python installation first. If Python is not found and
alertifpynotinstalled=1, it will open the Python download page.