更改当前启动项,开关Hyper-V

switch-HyperV.bat

 1 @echo off
 2 "%SYSTEMROOT%system32cacls.exe" "%SYSTEMROOT%system32configSYSTEM" >nul 2>nul
 3 if %errorlevel%==0 goto :start
 4 
 5 chcp 936>nul
 6 echo Please use administrator account to run.
 7 echo 请以管理员身份运行。
 8 pause
 9 goto :end
10 
11 :start
12 pushd "%~dp0"
13 :menu
14 echo MENU
15 echo 1. Set current boot item: hypervisorlaunchtype Auto
16 echo 2. Set current boot item: hypervisorlaunchtype Off
17 echo Q. Exit
18 echo.
19 echo Current status:
20 bcdedit /enum {current}|findstr hypervisorlaunchtype
21 echo.
22 set /p input=Please input: 
23 if "%input%"=="1" goto :auto
24 if "%input%"=="2" goto :off
25 if /i "%input%"=="q" goto :end
26 echo.
27 goto :menu
28 :auto
29 bcdedit /set {current} hypervisorlaunchtype auto
30 goto :menu
31 :off
32 bcdedit /set {current} hypervisorlaunchtype off
33 goto :menu
34 :end
35 popd
原文地址:https://www.cnblogs.com/Bob-wei/p/9294806.html