Last active
October 18, 2024 14:48
-
-
Save Csqhi515/90f63387d14b001a9e4b21a27b4e4e14 to your computer and use it in GitHub Desktop.
Enable or disable Hyper-V.
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 | |
net session >nul 2>&1 | |
if %errorlevel% neq 0 ( | |
echo Requesting administrative privileges... | |
if "%*"=="" (powershell -Command "Start-Process '%~f0' -Verb RunAs") else (powershell -Command "Start-Process '%~f0' -ArgumentList '%*' -Verb RunAs") | |
exit /b | |
) | |
:: To check if Hyper-V is active, run 'systeminfo' in the command prompt. | |
:: Disabling Hyper-V may improve performance by allowing the host OS to run more directly. | |
:: VirtualMachinePlatform is currently required by WSL. | |
:: To turn it off using bcdedit, if required, | |
:: bcdedit /deletevalue hypervisorlaunchtype | |
:: OR | |
:: bcdedit /set hypervisorlaunchtype off | |
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart | |
dism.exe /online /disable-feature /featurename:Microsoft-Hyper-V-All | |
cmd /k |
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 | |
net session >nul 2>&1 | |
if %errorlevel% neq 0 ( | |
echo Requesting administrative privileges... | |
if "%*"=="" (powershell -Command "Start-Process '%~f0' -Verb RunAs") else (powershell -Command "Start-Process '%~f0' -ArgumentList '%*' -Verb RunAs") | |
exit /b | |
) | |
:: To check if Hyper-V is active, run 'systeminfo' in the command prompt. | |
:: Disabling Hyper-V may improve performance by allowing the host OS to run more directly. | |
:: VirtualMachinePlatform is currently required by WSL. | |
:: This line is only required if this value is set to off. | |
:: bcdedit /set hypervisorlaunchtype auto | |
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all | |
:: Enable this line if full Hyper-V is required. | |
:: dism.exe /online /enable-Feature /featurename:Microsoft-Hyper-V /all | |
cmd /k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment