@echo off
setlocal
title Install Synchro Skills

set "SCRIPT_URL=https://supakrizs-synchro-installer.pages.dev/Install-Skills.ps1"
set "SCRIPT_FILE=%TEMP%\Install-Synchro-Skills.ps1"

echo.
echo Downloading the Synchro skill installer...
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -UseBasicParsing -Uri '%SCRIPT_URL%' -OutFile '%SCRIPT_FILE%' } catch { Write-Error $_; exit 1 }"
if errorlevel 1 (
  echo.
  echo Could not download the installer.
  pause
  exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_FILE%"
set "RESULT=%ERRORLEVEL%"

echo.
if "%RESULT%"=="0" (
  echo Installation finished successfully.
) else (
  echo Installation stopped with an error. Review the message above.
)
pause
exit /b %RESULT%
