Created
May 20, 2022 22:42
-
-
Save albertopasqualetto/257bd83fe47b8c11e4ce1fa46bb82781 to your computer and use it in GitHub Desktop.
bcdEdit auto switch hypervisor
This file contains hidden or 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 | |
:: Source: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file | |
:: Source: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights | |
:: batch code to request admin previleges, if no admin previleges | |
fltmc >nul 2>&1 | |
if NOT %errorLevel% == 0 ( | |
powershell start -verb runas '%0' am_admin & exit /b | |
) | |
bcdedit | findstr /c:"hypervisorlaunchtype Auto" >nul 2>&1 | |
if errorlevel == 1 ( | |
echo Set hypervisorlaunchtype to auto (Use WSL2^) | |
pause | |
bcdedit /set hypervisorlaunchtype auto | |
) else ( | |
echo Set hypervisorlaunchtype to off (Use VMWare^) | |
pause | |
bcdedit /set hypervisorlaunchtype off | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment