This is a small note, but it is the kind of small note that saves a future half hour.

The symptom was:

1
wsl: Unknown key 'wsl2.autostart' in C:\Users\<user>\.wslconfig

The useful answer is simple: that is not a valid WSL config key.

What to Do Instead

If you want WSL to start automatically, use one of the Windows startup mechanisms instead of inventing a .wslconfig setting.

Option 1: Task Scheduler

If you want WSL to start quietly in the background:

  1. Open Task Scheduler.
  2. Create a task that runs At log on.
  3. Use wsl.exe as the program.
  4. Pass -d <DistroName> as the argument.

That is the cleaner option when you do not want a terminal window appearing at login.

Option 2: Startup Folder

If you want the simplest path and do not mind a window opening:

  1. Press Win + R
  2. Run shell:startup
  3. Create a shortcut to wsl.exe

That starts the default distro when you log in.

Closing Thought

This is not a deep WSL article. It is just a reminder that when a config key does not exist, the fix is not to search for a more magical config key. Sometimes the real answer is to use the operating system feature that was meant for the job.