@echo off
setlocal EnableExtensions
set "SOURCE=%~dp0."
set "TARGET=%LOCALAPPDATA%\GameBoost-Haxu"

echo Installing GameBoost-Haxu...
robocopy "%SOURCE%" "%TARGET%" /E /R:2 /W:1 /NFL /NDL /NJH /NJS >nul
if errorlevel 8 (
  echo Installation failed. Please close GameBoost-Haxu and try again.
  pause
  exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$shell = New-Object -ComObject WScript.Shell; $desktop = [Environment]::GetFolderPath('Desktop'); $shortcut = $shell.CreateShortcut((Join-Path $desktop 'GameBoost-Haxu.lnk')); $shortcut.TargetPath = Join-Path $env:LOCALAPPDATA 'GameBoost-Haxu\GameBoost-Haxu.exe'; $shortcut.WorkingDirectory = Join-Path $env:LOCALAPPDATA 'GameBoost-Haxu'; $shortcut.IconLocation = $shortcut.TargetPath + ',0'; $shortcut.Description = 'GameBoost-Haxu Windows game optimization'; $shortcut.Save()"

start "" "%TARGET%\GameBoost-Haxu.exe"
endlocal
