Skip to content

Instantly share code, notes, and snippets.

@rikka0w0
Created September 5, 2025 16:43
Show Gist options
  • Save rikka0w0/a5b3e599afb80d4bb507f5f8958e8a97 to your computer and use it in GitHub Desktop.
Save rikka0w0/a5b3e599afb80d4bb507f5f8958e8a97 to your computer and use it in GitHub Desktop.
Launch WSL2 on Windows startup (No login required)
  1. You need to install and configure WSL2 properly before proceed. Assume the distro name is Ubuntu.
  2. Create a task that runs on startup. Replace and with the owner of the WSL2 distro. (Note that WSL2 distro is per-user based, not system-wide.)
schtasks /create /tn "WSLKeepAlive" /tr "wsl -d Ubuntu sleep infinity" /sc ONSTART /ru <USERNAME> /rp <PASSWORD>
  1. Run this task now to start WSL2:
schtasks /run /tn "WSLKeepAlive"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment