Created
February 14, 2018 05:38
-
-
Save rkttu/606fd2528b935745fc7df58ef6fc4347 to your computer and use it in GitHub Desktop.
Windows Hypervisor Switch Tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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