Skip to content

Instantly share code, notes, and snippets.

@rkttu
Created February 14, 2018 05:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rkttu/606fd2528b935745fc7df58ef6fc4347 to your computer and use it in GitHub Desktop.
Save rkttu/606fd2528b935745fc7df58ef6fc4347 to your computer and use it in GitHub Desktop.
Windows Hypervisor Switch Tool
@echo off
pushd "%~dp0"
cls
echo This script allows you to easily turn on or off Windows Hypervisor settings at once. This script is useful when you want to use Hyper-V or Docker for Windows with other hypervisors.
echo.
net session >nul 2>&1
if not %errorLevel% == 0 (
echo To run this script, you must run it as a user with administrative privileges.
pause >nul
goto end
)
bcdedit /enum
echo.
choice /c ync /m "To enable system hypervisor, press 'Y'. To disable system hypervisor, press 'N'. To cancel, press 'C'."
if %errorlevel%==1 (
bcdedit /set hypervisorlaunchtype auto
) else (
if %errorlevel%==2 (
bcdedit /set hypervisorlaunchtype off
) else (
goto end
)
)
choice /c yn /m "To take the effect, you should restart the system now. Restart now?"
if %errorlevel%==1 (
shutdown /r /t 0
) else (
goto end
)
:end
popd
@echo on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment