Windows 10 子系统 重启 停止

  • 对应的命令是net stop lxssmananger(在管理员Cmd中执行)
  • 可以写在bat文件里
    • restart.bat
    @echo off  
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 
     
    if '%errorlevel%' NEQ '0' (  
        goto UACPrompt  
    ) else ( goto gotAdmin )  
       
    :UACPrompt  
        echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 
        echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" 
        "%temp%\getadmin.vbs" 
        exit /B  
       
    :gotAdmin  
        if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )  
        pushd "%CD%" 
        CD /D "%~dp0" 
     
    :begin
    net stop lxssmanager
    net start lxssmanager
    
    • stop.bat
    @echo off  
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 
     
    if '%errorlevel%' NEQ '0' (  
        goto UACPrompt  
    ) else ( goto gotAdmin )  
       
    :UACPrompt  
        echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 
        echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" 
        "%temp%\getadmin.vbs" 
        exit /B  
       
    :gotAdmin  
        if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )  
        pushd "%CD%" 
        CD /D "%~dp0" 
     
    :begin
    net stop lxssmanager
    
posted @ 2019-06-03 17:11  twfb  阅读(2623)  评论(0编辑  收藏  举报