@echo off
chcp 65001 >nul
setlocal
title YarMenu Accounting - Register in Windows Apps

set "INSTALL_DIR=%LOCALAPPDATA%\YarMenu\Accounting"
if not exist "%INSTALL_DIR%\yarmenu_accounting.exe" (
    echo [ERROR] YarMenu Accounting is not installed in:
    echo %INSTALL_DIR%
    echo.
    echo Run Setup.bat first.
    pause
    exit /b 1
)

powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0register_windows_app.ps1" -InstallDir "%INSTALL_DIR%"
if errorlevel 1 (
    echo.
    echo [ERROR] Registration failed.
    pause
    exit /b 1
)

echo.
echo Done. Search for "YarMenu" in Start menu or Settings ^> Apps.
pause
