diff --git a/README.md b/README.md index 05282bf..bb82c35 100644 --- a/README.md +++ b/README.md @@ -257,21 +257,3 @@ chmod u+x ./simplewc.py ``` ____ -## `hvswitch`.cmd -**Description:** Microsoft Hyper-V switch on/off -**Dependencies:** Windows with Hyper-V (tested Windows 10 Pro x64), - - -| PARAMETERS | DESCRIPTION | DEFAULT| -|-------------|-------------|--------| -|**[qn]**|execution without pauses (**use only in 1st position**)|| -|**[y]**|enable Hyper-V, if it off (**use only in 2nd position**)|| -|**[n]**|disable Hyper-V, if it on (**use only in 2nd position**)|| - -Example usage in terminal: -```cmd -.\hvswitch.cmd qn y -``` - -____ - diff --git a/hvswitch.cmd b/hvswitch.cmd deleted file mode 100644 index dc91f4e..0000000 --- a/hvswitch.cmd +++ /dev/null @@ -1,65 +0,0 @@ -pushd "%~dp0" -@echo off -goto :Start - --------------------------------------------------- -Microsoft Hyper-V switch on/off - -Positional parameters: - [1] qn - execution without pauses - [2] y - enable Hyper-V, if it off - n - disable Hyper-V, if it on - --------------------------------------------------- - -:Start - set choice=%~2 - -:Admin_Check - net session >nul 2>&1 - if %errorLevel% == 0 ( - set code=0 - ) else ( - set code=5 - cls - echo Restart this as Administrator! - goto :Exit - ) - -:HV_Check - bcdedit /enum | FINDSTR /IL "hypervisorlaunchtype" | FINDSTR /IL "auto" - if %errorLevel% EQU 0 ( - set state=auto - ) else ( - set state=off - ) - -:HV_Choice - cls - if "%choice%" EQU "y" ( - if "%state%" EQU "auto" goto :Exit - goto :HV_enable - ) - if "%choice%" EQU "n" ( - if "%state%" NEQ "auto" goto :Exit - goto :HV_disable - ) - set /p choice= Do you need a Hyper-V enabled? [y or no]: - goto :HV_Choice - -:HV_enable - echo Hyper-V enabled... - bcdedit /set hypervisorlaunchtype auto - shutdown -r -f -t 5 -c "After 5 seconds, the computer will restart" - goto :Exit - -:HV_disable - echo Hyper-V disabled... - bcdedit /set hypervisorlaunchtype off - shutdown -r -f -t 5 -c "After 5 seconds, the computer will restart" - goto :Exit - -:Exit -if "%~1" NEQ "qn" pause -popd -exit %code%