@echo off
REM FlewHaul portable launcher. Double-click to run; optionally pins a Desktop shortcut.
setlocal
set HERE=%~dp0
REM Create an elevated Desktop shortcut the first time (so the app + engine run as admin).
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$d=[Environment]::GetFolderPath('Desktop'); $lnk=Join-Path $d 'FlewHaul.lnk';" ^
  "if(-not (Test-Path $lnk)){ $sh=New-Object -ComObject WScript.Shell; $s=$sh.CreateShortcut($lnk);" ^
  "$s.TargetPath='%HERE%FlewHaul.exe'; $s.WorkingDirectory='%HERE%'; $s.IconLocation='%HERE%FlewHaul.ico,0';" ^
  "$s.Description='FlewHaul behavioral security sentinel'; $s.Save();" ^
  "$b=[IO.File]::ReadAllBytes($lnk); $b[0x15]=$b[0x15] -bor 0x20; [IO.File]::WriteAllBytes($lnk,$b);" ^
  "Write-Host 'Desktop shortcut created (runs as Administrator).' }"
REM Launch the app elevated so the engine has full rights.
powershell -NoProfile -Command "Start-Process -FilePath '%HERE%FlewHaul.exe' -Verb RunAs"
endlocal
