-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
45 lines (39 loc) · 1.28 KB
/
Copy pathrun.bat
File metadata and controls
45 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
set PORT=8000
set "CMD="
where python >nul 2>nul
if %errorlevel%==0 set "CMD=python"
if not defined CMD (
where py >nul 2>nul
if !errorlevel!==0 set "CMD=py"
)
if defined CMD (
REM Windows sometimes aliases "python" to a non-functional Microsoft
REM Store stub - make sure it actually runs before trusting it.
%CMD% --version >nul 2>nul
if !errorlevel! neq 0 set "CMD="
)
if defined CMD (
echo Starting local server with %CMD% on port %PORT%...
start "Python Quest Server" /min %CMD% -m http.server %PORT%
goto :launch
)
where npx >nul 2>nul
if %errorlevel%==0 (
echo Python not found - starting local server with npx serve on port %PORT%...
start "Python Quest Server" /min npx --yes serve -l %PORT% .
goto :launch
)
echo No Python or Node.js found - using the built-in Windows fallback server...
start "Python Quest Server" /min powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0server.ps1" -Port %PORT%
:launch
timeout /t 2 /nobreak >nul
start "" http://localhost:%PORT%/
echo.
echo Game running at http://localhost:%PORT%/
echo Close the "Python Quest Server" window (or press any key here) to stop.
pause >nul
taskkill /fi "WindowTitle eq Python Quest Server*" /t /f >nul 2>nul
goto :eof