@echo off
echo off
setlocal EnableDelayedExpansion
rem -----------------------------------------------
rem this shell for an unified installation(window)
rem -----------------------------------------------
set MODE=%1
set AGENT_ROOT=%~dp0
set TASK_NAME="AGENT_ASSIST_TASK"
set file="!AGENT_ROOT!conf\common.conf"
for /f "tokens=3 delims= " %%i in ('findstr /C:"install_path =" %file%') do ( set INSTALL_PATH=%%i)
for /f "tokens=3 delims= " %%i in ('findstr /C:"python_path =" %file%') do ( set PATHON_PATH=%%i)

call :delete_scheduled_task
%PATHON_PATH% %INSTALL_PATH%\AgentAssist\bin\assist\agentassisthandle\stop.py

if !MODE! NEQ "CALLED" (
    pause
)

exit /b 0

:delete_scheduled_task
    schtasks /query /tn %TASK_NAME% >nul 2>nul
    if %errorlevel% == 0 (
        schtasks /delete /f /tn %TASK_NAME% > nul
    )
    goto :EOF
