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:

  1. Set vmIdleTimeout=-1 in .wslconfig.
  2. @start /b nircmd execmd wsl, which freezes Windows.
  3. Just @start /b wsl. The terminal window still shows up, and closing it will terminate WSL.