@echo off rem ============================================================================ rem Guanlan run.bat - start / stop / restart / status rem rem ASCII ONLY ON PURPOSE (see docs 11.3): Chinese text inside a .bat is rem codepage dependent, and cmd.exe has been observed executing parts of it. rem rem Usage: rem run.bat start start all services (same as: python guanlan.py serve) rem run.bat stop stop all services rem run.bat restart stop then start rem run.bat status show service status (port / pid / alive) rem run.bat status --json machine readable status rem run.bat help this text rem rem Any extra arguments are passed through to guanlan.py, e.g. rem run.bat start --only algorithm,web rem run.bat status rem ============================================================================ chcp 65001 >nul set PYTHONUTF8=1 cd /d "%~dp0" set "PY=%~dp0.venv\Scripts\python.exe" if not exist "%PY%" ( echo [X] Python runtime not found: %PY% echo Run install.bat first, or set up .venv in this folder. pause exit /b 2 ) set "SUB=%~1" if "%SUB%"=="start" goto do_start if "%SUB%"=="stop" goto do_stop if "%SUB%"=="restart" goto do_restart if "%SUB%"=="status" goto do_status if "%SUB%"=="help" goto do_help if "%SUB%"=="" goto do_help goto do_other :do_start shift "%PY%" guanlan.py serve %1 %2 %3 %4 %5 %6 %7 %8 %9 goto done :do_stop "%PY%" guanlan.py stop goto done :do_restart "%PY%" guanlan.py stop "%PY%" guanlan.py serve goto done :do_status shift "%PY%" guanlan.py status %1 %2 %3 %4 %5 goto done :do_other "%PY%" guanlan.py %* goto done :do_help echo Usage: run.bat ^ [options] echo start start all services stop stop all services echo restart stop then start status service status echo help this text goto done :done pause