`1. Create startup script and customize script content sudo vi /etc/init.wsl #!/bin/sh /etc/init.d/smbd start /etc/init.d/mysqld start 2. Add execution permission sudo chmod +x /etc/init.wsl 3. Edit sudoers to avoid entering password sudo visudo perhaps sudo nano /etc/sudoers Add a row %sudo ALL=NOPASSWD: /etc/init.wsl 4. Return to the windows interface to create a startservice.vbs script. The content is: Set ws = WScript.CreateObject("WScript.Shell") ws.run "C:\Windows\System32\bash.exe -c 'sudo /etc/init.wsl'",0 5. Press Win + R to enter the shell: the startup system will automatically open a directory. At this time Put the vbs script created in the previous step into this directory 6. Restart the computer
Рубрики