@echo off setlocal REM Verify that all four arguments were provided if "%~4"=="" ( echo Error: Missing arguments. echo Usage: %0 ^ ^ ^ ^ exit /b 1 ) set "PARENT_PID=%1" set "INSTALLER_PATH=%2" set "MAIN_APP_PATH=%3" set "CREDS=%~4" :WAIT_FOR_PARENT_EXIT echo Waiting for parent process (PID: %PARENT_PID%) to close... tasklist /fi "pid eq %PARENT_PID%" | find "%PARENT_PID%" >nul if %errorlevel% == 0 ( timeout /t 1 /nobreak >nul goto WAIT_FOR_PARENT_EXIT ) start "" /wait "%INSTALLER_PATH%" /VERYSILENT del "%INSTALLER_PATH%" echo Installed new version %INSTALLER_PATH% start "" "%MAIN_APP_PATH%" -c "%CREDS%" echo Loading... :WAIT_FOR_APP_START timeout /t 1 /nobreak >nul tasklist /fi "imagename eq azaion-inference.exe" | find "azaion-inference.exe" >nul if %errorlevel% neq 0 goto WAIT_FOR_APP_START timeout /t 5 /nobreak >nul echo Process started. endlocal