简单,测试成功。
在%AppData%\Microsoft\Windows\Start Menu\Programs\Startup 目录内创建文件 wsl.vbs 内容如下:
set ws=wscript.createobject("wscript.shell")
ws.run "C:\Windows\System32\bash.exe",0
ws.run "C:\Windows\System32\bash.exe -c '/usr/sbin/service ssh start'",0
ws.run "C:\Windows\System32\bash.exe -c '/usr/sbin/service mysql start'",0
ws.run "C:\Windows\System32\bash.exe -c '/usr/sbin/service apache2 start'",0
启动 ssh mysql apache2 三个服务。