From a4e3ff0e2f69022b7ebe081d6f17d531b339aa95 Mon Sep 17 00:00:00 2001 From: alexpolo1 Date: Sat, 20 Jun 2026 00:14:17 +0200 Subject: [PATCH] install.bat: fix Win11 detection, stale errorlevel in blocks, remove pause - Echo with (no ABSOLUTE flag) had unescaped ) closing the if block early, causing BOTH Win11 and Win10 branches to run and wrong requirements used. Fix: escape the parens with ^( and ^). - %errorlevel% inside ( ) blocks is expanded at parse time, not after the command that sets it. Affects winget install result check, tesseract winget check, pytesseract check, and dependency verify loop. Fix: use !errorlevel! (delayed expansion) in those four spots. - Remove final pause so the CMD window closes automatically on success. Co-Authored-By: Claude Sonnet 4.6 --- install.bat | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/install.bat b/install.bat index 1036f1f..5571188 100644 --- a/install.bat +++ b/install.bat @@ -18,7 +18,7 @@ if not defined WIN_BUILD ( echo Detected Windows build: %WIN_BUILD% set /a "WIN_BUILD_NUM=%WIN_BUILD%" 2>nul || set "WIN_BUILD_NUM=0" if %WIN_BUILD_NUM% GEQ 22000 ( - echo Detected Windows 11 — using relative mouse mode (no ABSOLUTE flag) + echo Detected Windows 11 -- using relative mouse mode ^(no ABSOLUTE flag^) set "WIN11=1" set "REQ_FILE=requirements-win11.txt" set "ENV_FILE=environment-win11.yml" @@ -64,7 +64,7 @@ if %errorlevel% equ 0 ( echo Installing via winget... winget install --id CondaForge.Miniforge3 --exact --silent ^ --accept-package-agreements --accept-source-agreements - if %errorlevel% equ 0 goto :rescan_conda + if !errorlevel! equ 0 goto :rescan_conda echo winget install failed — falling back to direct download. echo. ) @@ -283,7 +283,7 @@ if exist "dependencies\tesserocr.cp310-win_amd64.pyd" ( if not exist "C:\Program Files\Tesseract-OCR\tesseract.exe" ( echo Installing Tesseract OCR via winget... winget install --id tesseract-ocr.tesseract --silent --accept-package-agreements --accept-source-agreements 2>nul - if %errorlevel% neq 0 ( + if !errorlevel! neq 0 ( echo winget failed -- on Windows 10 you may need to install manually: echo https://github.com/tesseract-ocr/tesseract/releases echo Download the win64 installer, run it, keep the default install path. @@ -306,7 +306,7 @@ if %errorlevel% == 0 ( if exist "C:\Program Files\Tesseract-OCR\tesseract.exe" ( "%CONDA_EXE%" run -n botty python -c "import pytesseract; pytesseract.pytesseract.tesseract_cmd=r'C:\Program Files\Tesseract-OCR\tesseract.exe'; pytesseract.get_tesseract_version()" >nul 2>&1 - if %errorlevel% == 0 ( + if !errorlevel! == 0 ( echo pytesseract: OK ^(reliable fallback^) set "OCR_READY=1" ) else ( @@ -330,7 +330,7 @@ set "ALL_OK=1" for %%M in (cv2 mss numpy discord transitions rapidfuzz) do ( set "PATH=%TESS_PATH%;%PATH%" "%CONDA_EXE%" run -n botty python -c "import %%M" >nul 2>&1 - if %errorlevel% neq 0 ( + if !errorlevel! neq 0 ( echo FAILED: %%M set "ALL_OK=0" ) else ( @@ -358,4 +358,3 @@ echo Installation complete! echo Run botty with: run_botty.bat echo ============================================ echo. -pause