The latest build of Windows 10 allows WSL distributions to run Linux commands on startup. Users participating in the Windows Insider program (that is, those with access to the Windows 10 test builds) now have a powerful new functionality at their disposal: that of executing Linux commands during the startup of any of the distributions. WSL.
Advanced users, as well as anyone with an interest in ‘tinkering’ with their operating system, will no doubt welcome this option which extends the utility of the Windows Subsystem for Linux (WSL).
This functionality debuts with Windows 10 build 21286
Brandon LeBlanc, head of the Windows Insider program, explains it in an article published on his blog :
“We have added an option that allows you to run any specified Linux command when starting a WSL distribution. To do this, edit the /etc/wsl.conf file on your distribution and add an option titled ‘command’ in a section titled ‘boot’ “.
“This command will run whenever the specific WSL distribution is started. The following example shows the use of this functionality to create a method to record the time and date for each start of this WSL distribution.”
As stated by LeBlanc, any command indicated in the aforementioned ‘boot’ section will be executed when the WSL distribution starts, which will remain running for a few minutes after the last Linux process is closed.
Thus, users who want to enjoy this functionality must make sure they have Windows 10 Build 21286 installed , whose ISO you can access here if you have the corresponding Windows Insider account.