@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b

set CONFIG=config\install-wezterm.txt
set EXE=..\software\wezterm-setup.exe
set STARTMENU="%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs"

if NOT EXIST %EXE% (
  echo ERROR: %EXE% not found!
  exit /b
)

echo ####### %0 #######

echo killing WezTerm processes...
taskkill /F /IM wezterm-gui.exe 2>nul

echo installing WezTerm ...
start /wait %EXE% /LOADINF=%CONFIG% /NORESTART /NOCANCEL /SILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS

echo copy startmenu link ...
copy /Y startmenu\WezTerm.lnk %STARTMENU%
copy /Y startmenu\WezTerm.lnk %PUBLIC%\Desktop

rem refresh desktop (W10 style)
ie4uinit.exe -show

echo ####### %0 #######
pause

