22 lines
737 B
Batchfile
22 lines
737 B
Batchfile
@echo off
|
|
rem BiliDownloader 启动脚本:起本地服务 + 开 Edge 应用模式窗口
|
|
setlocal
|
|
cd /d "%~dp0"
|
|
set "PYTHONIOENCODING=utf-8"
|
|
|
|
rem 已经有实例在跑,就直接把窗口拉起来,不要再起一个服务
|
|
powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 8799 -State Listen -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }" >nul 2>nul
|
|
if %errorlevel%==0 (
|
|
start "" "msedge" --app=http://127.0.0.1:8799/ --window-size=1280,860
|
|
exit /b 0
|
|
)
|
|
|
|
rem 优先用 pythonw(无控制台窗口),没有就退回 python
|
|
where pythonw >nul 2>nul
|
|
if %errorlevel%==0 (
|
|
start "" pythonw "%~dp0server.py" --port 8799
|
|
) else (
|
|
start "" /min python "%~dp0server.py" --port 8799
|
|
)
|
|
exit /b 0
|