@echo off
REM Double-click launcher for the Cubie TEP demo
REM Runs the PowerShell script in this same folder, bypassing execution policy.

setlocal
set "SCRIPT_DIR=%~dp0"
set "DEMO_PS1=%SCRIPT_DIR%Cubie_TEP_Demo.ps1"

if not exist "%DEMO_PS1%" (
    echo Cubie_TEP_Demo.ps1 not found next to this .bat
    pause
    exit /b 1
)

REM Prefer pwsh (PowerShell 7) when available, fall back to Windows PowerShell.
where /q pwsh
if %ERRORLEVEL%==0 (
    pwsh -NoLogo -ExecutionPolicy Bypass -File "%DEMO_PS1%" %*
) else (
    powershell -NoLogo -ExecutionPolicy Bypass -File "%DEMO_PS1%" %*
)

echo.
echo Demo finished. Press any key to close this window.
pause >nul
