@echo off
setlocal
chcp 65001 >nul
cd /d "%~dp0"
title Xingmu WeChat Channels Local Saver

set "APP=%~dp0res-downloader_3.1.3_win_amd64.exe"

if not exist "%APP%" (
  echo.
  echo Program file is missing:
  echo %APP%
  echo.
  pause
  exit /b 1
)

powershell.exe -NoProfile -Command "Start-Process -FilePath '%APP%' -Verb RunAs"
if errorlevel 1 (
  echo.
  echo The program could not be started.
  echo Please right-click res-downloader_3.1.3_win_amd64.exe and choose Run as administrator.
  echo.
  pause
  exit /b 1
)

exit /b 0
