Files
app-cli/dev.cmd
toom1996 b993b4d61e update
2026-10-22 19:58:53 +08:00

35 lines
954 B
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
rem dev.cmd — 双击即可启动本地开发环境(等同于 .\dev\dev.ps1)
rem 参数原样透传,例如:dev.cmd -Vision -Open dev.cmd -Foreground
rem
rem 窗口策略:
rem 失败 → pause,保留报错,不再一闪而过
rem 前台模式 → 脚本本身会阻塞到 Ctrl+C,结束后 pause
rem 成功(后台) → pause,保留地址信息(关窗口不影响服务)
setlocal
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0dev\dev.ps1" %*
set RC=%ERRORLEVEL%
echo.
if not "%RC%"=="0" (
echo [启动失败,退出码 %RC%] 上面就是原因,窗口先留着。
echo 详细日志:app-cli\.logs\ 查看:.\dev\logs.ps1 -Follow
pause
exit /b %RC%
)
echo %* | findstr /i /c:"-Foreground" >nul 2>&1
if not errorlevel 1 (
echo [前台模式已结束]
pause
exit /b 0
)
echo [服务已在后台运行,关掉本窗口不会停止服务]
echo 看实时输出:dev.cmd -Foreground ^(前后端输出都在这个窗口^)
echo 查看日志文件:.\dev\logs.ps1 -Follow
echo 停止服务:.\dev\stop.ps1
echo.
pause
exit /b 0