- Compile
runsilent.c
in Windows - Compile
dummy.c
in Linux - Import the task with
schtasks
in Windows, modify the path as needed before importing.
- When you shutdown the WSL (with
wsl --shutdown
), to start it again in background, runschtasks /run /tn:wslon
. No administrator privileges is required. - If you have more than 1 distro and want them to start too, you need to:
- Perform step 2 on each distro. Copying existing binary may work, but there's no guarantee.
- Add additional
<Exec></Exec>
in the XML, or add "Start a program" action in Task Scheduler. - Adjust the WSL command-line as needed (by adding
-d <distro>
.