@echo off
chcp 65001 >nul
setlocal
cd /d "%~dp0"

echo ============================================
echo   YarMenu Accounting - Visual C++ Runtime
echo ============================================
echo.

if not exist "vc_redist.x64.exe" (
    echo [ERROR] File not found: vc_redist.x64.exe
    echo Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe
    pause
    exit /b 1
)

echo Installing Microsoft Visual C++ 2015-2022 (x64)...
echo Please wait...
echo.

vc_redist.x64.exe /install /quiet /norestart

if errorlevel 1 (
    echo.
    echo Install finished with warnings. Try running yarmenu_accounting.exe anyway.
) else (
    echo.
    echo Done. You can run yarmenu_accounting.exe now.
)

echo.
pause
