@echo off
setlocal
cd /d "%~dp0"
set "LOG=%~dp0plokar-flux-error.log"
if not exist "%~dp0FluxAnalyzer.ps1" (
  echo FluxAnalyzer.ps1 file was not found.
  echo Please extract the ZIP file first, then run this file again.
  pause
  exit /b 1
)
if exist "%LOG%" del "%LOG%"
powershell.exe -STA -NoProfile -ExecutionPolicy Bypass -File "%~dp0FluxAnalyzer.ps1" > "%LOG%" 2>&1
if errorlevel 1 (
  echo.
  echo Plokar Flux Analyzer could not start.
  echo Opening error log...
  start notepad "%LOG%"
  pause
  exit /b 1
)
if exist "%LOG%" del "%LOG%"
