@echo off setlocal EnableExtensions title Sundy Gemini CLI Installer set "SCRIPT_URL=https://sundy.tumpai.site/install-gemini.ps1" set "SCRIPT_FILE=%TEMP%\gemini-sundy-install.ps1" set "LOG_FILE=%TEMP%\gemini-sundy-install-cmd.log" set "PS_EXE=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" echo Sundy Gemini CLI Installer echo =========================== echo. echo This wrapper keeps the window open even if download or PowerShell fails. echo Log file: %LOG_FILE% echo. echo Started at %DATE% %TIME% > "%LOG_FILE%" echo [1/3] Downloading installer... echo [1/3] Downloading installer... >> "%LOG_FILE%" del "%SCRIPT_FILE%" >nul 2>nul curl.exe -L -f -o "%SCRIPT_FILE%" "%SCRIPT_URL%" >> "%LOG_FILE%" 2>&1 if errorlevel 1 ( echo curl.exe failed. Trying certutil... echo curl.exe failed. Trying certutil... >> "%LOG_FILE%" del "%SCRIPT_FILE%" >nul 2>nul certutil -urlcache -split -f "%SCRIPT_URL%" "%SCRIPT_FILE%" >> "%LOG_FILE%" 2>&1 ) if not exist "%SCRIPT_FILE%" ( echo. echo ERROR: Failed to download installer. echo ERROR: Failed to download installer. >> "%LOG_FILE%" goto :fail ) for %%A in ("%SCRIPT_FILE%") do set "SCRIPT_SIZE=%%~zA" if "%SCRIPT_SIZE%"=="0" ( echo. echo ERROR: Downloaded installer is empty. echo ERROR: Downloaded installer is empty. >> "%LOG_FILE%" goto :fail ) echo [2/3] Running PowerShell installer... echo [2/3] Running PowerShell installer... >> "%LOG_FILE%" if not exist "%PS_EXE%" ( echo. echo ERROR: powershell.exe was not found at %PS_EXE% echo ERROR: powershell.exe was not found at %PS_EXE% >> "%LOG_FILE%" goto :fail ) set "GEMINI_SUNDY_NO_PAUSE=1" "%PS_EXE%" -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_FILE%" set "INSTALL_EXIT=%ERRORLEVEL%" echo PowerShell installer exit code: %INSTALL_EXIT% >> "%LOG_FILE%" if not "%INSTALL_EXIT%"=="0" ( echo. echo ERROR: PowerShell installer failed with exit code %INSTALL_EXIT%. echo ERROR: PowerShell installer failed with exit code %INSTALL_EXIT%. >> "%LOG_FILE%" goto :fail ) echo. echo [3/3] Done. echo [3/3] Done. >> "%LOG_FILE%" echo. echo If gemini cannot see the API key or YOLO wrapper, close this window and open a new PowerShell window. echo. if not "%GEMINI_CMD_NO_PAUSE%"=="1" pause goto :eof :fail echo. echo Installation did not complete. echo See log: %LOG_FILE% echo. if not "%GEMINI_CMD_NO_PAUSE%"=="1" pause goto :eof