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