tool.bat 1.06 KB
@echo off
rem Store edge tool menu (with a window) for on-site checks: self check, scan, network diagnosis, watch the ui login ...
rem The Windows service keeps running in the background; menu 7 (foreground mode) is refused while it runs.
cd /d "%~dp0"
if not exist "%~dp0config.ini" copy "%~dp0config.example.ini" "%~dp0config.ini" >nul
set PY=%~dp0python38\python.exe
rem running from the source tree: the runtime lives in vendor\
if not exist "%PY%" set PY=%~dp0vendor\python38\python.exe
if exist "%PY%" goto run
echo [ERROR] python38 folder not found. Please unzip the WHOLE package, do not move files out.
pause
exit /b 3
:run
set PYTHONNOUSERSITE=1
rem From here on everything is ONE block: cmd reads the whole block before running it, so a remote update may
rem replace this file (root files are synced from the new version) while the menu is open.
setlocal EnableDelayedExpansion
(
  "%PY%" "%~dp0main.py" %*
  set RC=!errorlevel!
  echo.
  echo ===== exit code !RC!  ^(0=ok 2=failed 3=config error 4=already running^)   logs: %~dp0logs\tool\ =====
  pause
  exit /b !RC!
)