diff --git a/src/release-zip/Bypass Windows 11 Requirements.cmd b/src/release-zip/Bypass Windows 11 Requirements.cmd index 769c408d29..90e97139ac 100644 --- a/src/release-zip/Bypass Windows 11 Requirements.cmd +++ b/src/release-zip/Bypass Windows 11 Requirements.cmd @@ -1,11 +1,11 @@ @echo off +setlocal EnableDelayedExpansion title Bypass Windows 11 Requirements - cd /d "%~dp0" -:: set ANSI escape characters -for /f %%A in ('forfiles /m "%~nx0" /c "cmd /c echo 0x1B"') do set "ESC=%%A" +:: Set ANSI escape characters +for /f %%a in ('forfiles /m "%~nx0" /c "cmd /c echo 0x1B"') do set "ESC=%%a" set "right=%ESC%[C" set "bullet= %ESC%[34m-%ESC%[0m" @@ -25,27 +25,25 @@ echo %bullet% Core isolation echo %bullet% Windows Hello echo %bullet% BitLocker echo] -echo This list could expand in the future, and might +echo This list could expand in the future and might echo not cover everything. echo] =2%%ESC%[1m%ESC%[33mType 'I understand' to continue: %ESC%[0m :: This forces the user to type 'I understand' on the same line -setlocal EnableDelayedExpansion set "str=I understand" -for /l %%A in (0 1 12) do ( - if not "!str:~%%A,1!"=="" call :xcopyInput "!str:~%%A,1!" +for /l %%a in (0 1 12) do ( + if not "!str:~%%a,1!"=="" call :xcopyInput "!str:~%%a,1!" ) -endlocal echo] echo %ESC%[2A%ESC%[?25l :runCommands -set regCommands=reg add HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1 /f ^^^> nul 2^^^>^^^&1 ^^^& ^ - reg add HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1 /f ^^^> nul 2^^^>^^^&1 ^^^& ^ - reg add HKLM\SYSTEM\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 1 /f ^^^> nul 2^^^>^^^&1 +set regCommands=reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f ^^^> nul 2^^^>^^^&1 ^^^& ^ + reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f ^^^> nul 2^^^>^^^&1 ^^^& ^ + reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f ^^^> nul 2^^^>^^^&1 -fltmc >nul 2>&1 +fltmc > nul 2>&1 if not "%errorlevel%"=="0" ( powershell -NoP Start -WindowStyle Hidden -Verb RunAs 'cmd.exe' -ArgumentList '/c %regCommands%' > nul 2>&1 || ( set retry=true @@ -70,16 +68,15 @@ exit /b :errorText <"action"> echo %ESC%[31m Error! %ESC%[0mPress any key to %~1... %ESC%[1A -exit /b +exit /b 1 :xcopyInput <"key"> set "key=" -setlocal DisableDelayedExpansion -for /f "delims=" %%C in ('2^>nul xcopy.exe /w /l "%~f0" "%~f0"') do if not defined key set "key=%%C" -endlocal && set^ ^"key=^^%key:~-1%^" ! -if /i "!key!"=="%~1" ( - if "%~1"==" " ( +for /f "delims=" %%a in ('2^>nul xcopy.exe /w /l "%~f0" "%~f0"') do if not defined key set "key=%%a" +set "key=!key:~-1!" +if /i "%key%" == "%~1" ( + if "%~1" == " " ( =1% ) else