Skip to content

Instantly share code, notes, and snippets.

@abdulhadad
Created September 5, 2016 15:20
Show Gist options
  • Save abdulhadad/f9ae06c1c588d8e6ede86e2bbfe1c4fa to your computer and use it in GitHub Desktop.
Save abdulhadad/f9ae06c1c588d8e6ede86e2bbfe1c4fa to your computer and use it in GitHub Desktop.
HyperV Switch On/Off for VMWare?Virtualbox or HyperV Environtment
@echo off
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges
)
echo "Run this script as Administrator
pause
exit /b
:gotPrivileges
set _show_lauchtype=bcdedit /enum {default}
rem see if device support hotspot
for /f "tokens=2" %%a in ('%_show_lauchtype% ^|find "hypervisorlaunchtype"') do @set _lauchtype=%%a
if "%_lauchtype%"=="Auto" (
echo setting off hyper-v
bcdedit /set hypervisorlaunchtype Off
)
if "%_lauchtype%"=="Off" (
echo setting on hyper-v
bcdedit /set hypervisorlaunchtype Auto
)
echo Enter to restart
pause
shutdown /r /t 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment