@echo off
chcp 65001 >nul
REM ============================================================
REM  AI Remote Repair - one-click installer launcher
REM  Auto-elevates to Administrator. The customer double-clicks
REM  this file and clicks "Yes" on the single UAC prompt.
REM  NOTE: this launcher is intentionally ASCII-only. cmd.exe
REM  parses .cmd files using the system OEM codepage (e.g. 950),
REM  so non-ASCII text inside an if(...) block can corrupt the
REM  block and break elevation. Chinese UI lives in install.ps1.
REM ============================================================
setlocal

REM Re-launch elevated if not already running as Administrator
fltmc >nul 2>&1
if not %errorlevel%==0 (
    echo Requesting administrator privileges...
    powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit /b
)

REM Unblock only our script files (Mark-of-the-Web); leave payload MSIs untouched
powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ChildItem -Path '%~dp0' -Recurse -Include *.ps1 -File | Unblock-File"

REM Run the main installer (Bypass applies to this process only)
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %*

echo.
pause
