File size: 685 Bytes
79dc9c8 | 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 | @echo off
chcp 65001 >nul
title Python 本地服务器 + 打开 HTML
:: ===== 配置区 =====
set PORT=8001
set DIR=D:\Task_projects\data_collection\web\Vchart :: 改成你的文件夹
set CHROME="C:\Program Files\Google\Chrome\Application\chrome.exe"
:: ==================
cd /d %DIR%
echo 启动 Python HTTP 服务器(端口 %PORT%)...
start "" python -m http.server %PORT%
:: 等待服务器启动
timeout /t 2 >nul
echo 使用 Chrome 打开所有 HTML 文件...
for %%f in (*.html) do (
start "" %CHROME% http://localhost:%PORT%/%%f
)
echo.
echo 服务器已启动,HTML 已全部打开
echo 关闭本窗口将停止服务器
pause
|