WSL 服务自动启动

 

在wsl里创建文件并授权
cat >/etc/init.wsl <<'EOF'
#! /bin/sh
/etc/init.d/cron $1
/etc/init.d/ssh $1
EOF
chmod 755 /etc/init.wsl

开始-运行
    shell:startup     # 打开存放启动文件的目录
    wsl -l            # 获取wsl的名称

创建文件 ubuntu18.04.vbs
Set ws = CreateObject("Wscript.Shell")
ws.run "wsl -d Ubuntu-16.04 -u root /etc/init.wsl start", vbhide

 

posted @ 2020-08-21 14:33  chenzechao  阅读(913)  评论(0编辑  收藏  举报