A Python script that automatically launches Windows Subsystem for Linux (WSL) when Windows starts up.
- 🚀 Automatically launches WSL on Windows startup
- 🖥️ Opens WSL in a visible terminal window (Windows Terminal or Command Prompt)
- 🐧 Ubuntu is the default target distribution (configurable)
- 📝 Comprehensive logging with rotation
- ⚙️ Configurable settings
- 🔧 Multiple startup integration methods (Scheduled Task or Startup Folder)
- 🛡️ Error handling and retry logic
- 📊 Support for multiple WSL distributions
- 🐳 Smart filtering (explicitly excludes Docker Desktop distributions)
- Windows 10 with WSL installed
- Python 3.6 or higher
- At least one Linux distribution installed (Ubuntu recommended as default)
- Docker Desktop WSL distributions are automatically excluded
-
Clone or download this project to your preferred directory
-
Install Python dependencies:
pip install -r requirements.txt -
Test the launcher manually:
python wsl_launcher.py
-
Set up automatic startup:
python startup_setup.py
Edit config.py to customize the behavior:
STARTUP_DELAY: Time to wait after Windows boot (default: 5 seconds)PREFERRED_DISTRIBUTION: Specific WSL distribution to launch (leave empty for Ubuntu default)ENABLE_LOGGING: Enable/disable detailed loggingMAX_LAUNCH_ATTEMPTS: Number of retry attemptsHIDE_CONSOLE: Hide console window when runningOPEN_TERMINAL_WINDOW: Open visible terminal window when launching WSL (default: True)
Note: The script defaults to launching Ubuntu but will launch the first available non-Docker distribution if Ubuntu is not installed. Docker Desktop distributions (docker-desktop, docker-desktop-data) are always excluded to allow Docker to manage them independently.
python wsl_launcher.pypython startup_setup.pyChoose from:
- Scheduled Task (Recommended) - More reliable, runs even if user isn't logged in
- Startup Folder Shortcut - Simpler but only runs when user logs in
Run the setup script again and choose option 3 to remove the automatic startup.
-
Startup Integration: The script integrates with Windows startup using either:
- Windows Task Scheduler (recommended)
- Startup folder shortcut
-
WSL Detection: Checks if WSL is installed and available
-
Distribution Discovery: Finds all installed WSL distributions
-
Launch Process: Launches WSL with a visible terminal window using Windows Terminal (preferred) or Command Prompt
-
Docker Filtering: Automatically excludes Docker Desktop distributions (
docker-desktop,docker-desktop-data) from launch candidates, allowing Docker to manage its own WSL instances independently -
Logging: Records all activities to a log file for troubleshooting
wsl --list --runningLogs are stored in: %USERPROFILE%\AppData\Local\WSLLauncher\wsl_launcher.log
- "WSL is not installed": Install WSL from Microsoft Store or PowerShell
- "No user WSL distributions found": Install Ubuntu or another Linux distribution from Microsoft Store
- Permission errors: Run PowerShell as Administrator for initial setup
- Docker distributions showing: This is normal - Docker Desktop distributions are intentionally excluded and managed separately
# List all WSL distributions
wsl --list --verbose
# Launch specific distribution
wsl -d Ubuntu-20.04
# Check WSL status
wsl --statuswsl-script/
├── wsl_launcher.py # Main launcher script
├── startup_setup.py # Windows startup integration
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
└── README.md # This file
This project is open source and available under the MIT License.
Feel free to submit issues, feature requests, or pull requests to improve this tool.
Note: This tool is designed for Windows 10 with WSL and targets Ubuntu by default (configurable). Docker Desktop WSL distributions are explicitly excluded and should be managed through Docker Desktop itself. Make sure WSL is properly installed and configured before using this launcher.