31 lines
731 B
Batchfile
31 lines
731 B
Batchfile
@echo off
|
|
set PYTHONUTF8=1
|
|
cd /d "%~dp0"
|
|
|
|
:: Start server in a separate window (detached, survives parent exit)
|
|
:: /MIN runs minimized so it doesn't pop up a console window
|
|
start "" /MIN runtime\python\python.exe scripts\start_server.py
|
|
|
|
:: Wait for PID file (up to 10 seconds)
|
|
set WAIT=0
|
|
:waitloop
|
|
if exist .server_pid goto gotpid
|
|
ping -n 2 127.0.0.1 >nul
|
|
set /a WAIT+=1
|
|
if %WAIT% lss 5 goto waitloop
|
|
|
|
:gotpid
|
|
if exist .server_pid (
|
|
set /p PID=<.server_pid
|
|
)
|
|
if defined PID (
|
|
echo TianXuan started. PID: %PID%
|
|
echo Visit: http://127.0.0.1:8000/
|
|
echo.
|
|
echo To stop: taskkill /F /PID %PID%
|
|
) else (
|
|
echo TianXuan started.
|
|
echo Visit: http://127.0.0.1:8000/
|
|
echo To stop: taskkill /F /IM python.exe
|
|
)
|