@echo off

:: Tự động yêu cầu quyền Admin
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo Dang yeu cau quyen Admin...
    powershell -Command "Start-Process -FilePath '%~f0' -WorkingDirectory '%~dp0' -Verb RunAs"
    exit /b
)

echo Dang cai dat QZ Tray...
start /wait "%~dp0qz-tray-installer.exe" /S

echo Doi QZ Tray khoi dong...
timeout /t 5 /nobreak >nul

echo Cai certificate vao Windows...
certutil -addstore -f "ROOT" "%~dp0qz-public.pem"

echo Khoi dong QZ Tray...
start "" "%ProgramFiles%\QZ Tray\qz-tray.exe"

echo.
echo Hoan tat! Tu nay in tu dong khong can xac nhan.
pause