TenkajinKB/start-dashboard.bat
2026-04-19 16:16:20 +08:00

39 lines
1.0 KiB
Batchfile

@echo off
chcp 65001 >nul 2>&1
title TH1 Dashboard Server
set PORT=5173
echo ================================================
echo TH1 Dashboard - Local Server
echo ================================================
echo.
:: Kill process occupying the port
echo [1/2] Checking port %PORT%...
for /f "tokens=5" %%a in ('netstat -aon ^| findstr ":%PORT% " ^| findstr "LISTENING"') do (
echo Found process PID %%a on port %PORT%, killing...
taskkill /F /PID %%a >nul 2>&1
)
echo Port %PORT% is ready.
echo.
:: Change to this bat file's directory
cd /d "%~dp0"
:: Start server
echo [2/2] Starting server...
echo http://localhost:%PORT%/Dashboard/pages/projects.html
echo.
echo Press Ctrl+C to stop.
echo ================================================
set PYTHONIOENCODING=utf-8
:: Open browser after 2 seconds (give server time to start)
start /b cmd /c "timeout /t 2 >nul && start http://localhost:%PORT%/Dashboard/pages/projects.html"
:: Start custom server (static files + map regeneration API)
python start-server.py
pause