Skip to content

Instantly share code, notes, and snippets.

@kntjspr
Created April 5, 2025 18:07
Show Gist options
  • Select an option

  • Save kntjspr/0196e5ad72dca67945086e1593fcd415 to your computer and use it in GitHub Desktop.

Select an option

Save kntjspr/0196e5ad72dca67945086e1593fcd415 to your computer and use it in GitHub Desktop.
Hyper-V & Virtualization Toggler – Enables quick toggling of virtualization settings to seamlessly switch between Docker/WSL environments and external Android emulators.
@echo off
:menu
cls
echo ============================================
echo Hyper-V and Virtualization Features Toggler
echo ============================================
echo 1. Disable Hyper-V and related features (for Android emulator)
echo 2. Enable Hyper-V and related features (for Docker, WSL2, etc.)
echo 3. Exit
echo ============================================
set /p choice="Enter your choice (1, 2, or 3): "
if "%choice%"=="1" goto disable
if "%choice%"=="2" goto enable
if "%choice%"=="3" exit
echo Invalid choice! Please try again.
pause
goto menu
:disable
echo Disabling Hyper-V and related features...
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V /All
dism.exe /Online /Disable-Feature:HypervisorPlatform
dism.exe /Online /Disable-Feature:VirtualMachinePlatform
echo Stopping and disabling Hyper-V services...
net stop vmms
sc config vmms start=disabled
net stop vmicheartbeat
sc config vmicheartbeat start=disabled
net stop vmickvpexchange
sc config vmickvpexchange start=disabled
net stop vmicrdv
sc config vmicrdv start=disabled
net stop vmicshutdown
sc config vmicshutdown start=disabled
net stop vmictimesync
sc config vmictimesync start=disabled
net stop vmicvss
sc config vmicvss start=disabled
echo Hyper-V and related features have been disabled.
echo Restart your computer to apply the changes.
pause
goto menu
:enable
echo Enabling Hyper-V and related features...
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
dism.exe /Online /Enable-Feature:HypervisorPlatform
dism.exe /Online /Enable-Feature:VirtualMachinePlatform
echo Starting and enabling Hyper-V services...
sc config vmms start=auto
net start vmms
sc config vmicheartbeat start=auto
net start vmicheartbeat
sc config vmickvpexchange start=auto
net start vmickvpexchange
sc config vmicrdv start=auto
net start vmicrdv
sc config vmicshutdown start=auto
net start vmicshutdown
sc config vmictimesync start=auto
net start vmictimesync
sc config vmicvss start=auto
net start vmicvss
echo Hyper-V and related features have been enabled.
echo Restart your computer to apply the changes.
pause
goto menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment