How to keep WSL running in the background
Create a file in %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup named wslstart.cmd with the following content:
@start /b wsl --exec dbus-launch true
The dbus related packages need to be present.
What didn't work for me:
-
Set
vmIdleTimeout=-1in.wslconfig. -
@start /b nircmd execmd wsl, which freezes Windows. -
Just
@start /b wsl. The terminal window still shows up, and closing it will terminate WSL.