jw项目windows环境软件安装
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.3 KiB

1 year ago
  1. @echo off
  2. chcp 65001 > nul
  3. setlocal
  4. set PORT=8089
  5. ::echo 正在检查端口 %PORT% 是否可用...
  6. :loop
  7. netstat -ano | findstr ":%PORT%" >nul
  8. if "%errorlevel%"=="0" (
  9. echo 端口 %PORT% 已启动,开始启动Nginx服务...
  10. goto check_nginx
  11. ) else (
  12. timeout /t 5 >nul
  13. goto loop
  14. )
  15. :check_nginx
  16. tasklist /FI "IMAGENAME eq nginx.exe" | find /I /N "nginx.exe" >NUL
  17. if "%ERRORLEVEL%"=="0" (
  18. echo Nginx服务已经在运行,重新加载Nginx配置...
  19. cd ./nginx
  20. nginx.exe -s reload
  21. ) else (
  22. echo Nginx服务正在启动,请稍等...
  23. cd ./nginx
  24. start nginx.exe
  25. timeout /t 5 /nobreak > nul
  26. )
  27. echo 检查Nginx服务是否已经启动成功...
  28. tasklist /FI "IMAGENAME eq nginx.exe" | find /I /N "nginx.exe" >NUL
  29. if "%ERRORLEVEL%"=="0" (
  30. echo Nginx服务已经成功启动。
  31. goto successful_actions
  32. ) else (
  33. echo 服务启动失败,正在重新尝试...
  34. goto check_nginx
  35. )
  36. endlocal
  37. :successful_actions
  38. echo 所有服务启动成功...
  39. echo 准备打开程序...
  40. :: start http://localhost:80
  41. :: start http://192.168.3.20:8083
  42. :: 启动程序
  43. call start_program.bat
  44. :: 调用同级目录下的脚本文件创建快捷方式到桌面
  45. cd..
  46. call copy__shortcut.bat
  47. :: 暂停,等待用户按下任意键
  48. :: pause
  49. exit