@echo off title Hyper V - VirtualBox :start set switch=false set hv=false set vb=false bcdedit | find "hypervisorlaunchtype Auto" > nul && set hv=true bcdedit | find "hypervisorlaunchtype Off" > nul && set vb=true if %hv%==true ( if %vb%==false ( goto hv ) else ( echo ERRRRRRRRRRROR. pause > nul exit ) ) else ( if %vb%==true ( goto vb ) else ( echo Error pause > nul exit ) ) :hv title Using Hyper-V echo Using Hyper-V set /p switch="Do you want to switch for VirtualBox? (y/n) " if %switch%==y ( bcdedit /set hypervisorlaunchtype off > nul && echo Success & title Using VirtualBox & goto restart || echo Fail to switch for VirtualBox. & pause > nul && exit ) else ( echo Bye pause > nul exit ) :vb title Using VirtualBox echo Using VirtualBox set /p switch="Do you want to switch for Hyper-V? (y/n) " if %switch%==y ( bcdedit /set hypervisorlaunchtype auto > nul && echo Success & title Using Hyper-V & goto restart || echo Fail to switch for Hyper-V. & pause > nul && exit ) else ( echo Bye pause > nul exit ) :restart set /p restart="Do you want to restart now ? (y/n) " if %restart%==y ( shutdown /r /t 0 && echo Restarting. || echo Fail to restart. ) else ( if %restart%==n ( goto start ) else ( echo Bye pause > nul exit ) ) pause > nul