@echo off
setlocal
cd /d "%~dp0"

REM Close RustDesk if it's running
taskkill /IM rustdesk.exe /F >nul 2>&1

REM Copy preconfigured settings for this user
set "CFGDIR=%APPDATA%\RustDesk\config"
mkdir "%CFGDIR%" >nul 2>&1
copy /Y "%~dp0RustDesk2.toml" "%CFGDIR%\RustDesk2.toml" >nul

REM Launch RustDesk normally
start "" "%~dp0rustdesk.exe"
