@echo off

call Config.cmd

rem 结束ApacheMonitor的进程
nircmd killprocess ApacheMonitor.exe

cd %Apache%
if not exist logs\httpd.pid goto startsvr

rem 结束Apache服务
:stopsvr
bin\httpd.exe -k stop -n Apache_Svr
bin\httpd.exe -k uninstall -n Apache_Svr

rem 启动Apache服务
:startsvr
bin\httpd.exe -k install -n Apache_Svr
bin\httpd.exe -k start -n Apache_Svr

rem 是否打开ApacheMonitor
set /p isamonitor=# 是否打开ApacheMonitor应用程序(Y/N)
if "%isamonitor%"=="Y" start bin\ApacheMonitor.exe
if "%isamonitor%"=="y" start bin\ApacheMonitor.exe

rem 是否打开浏览页
set /p isweb=# 是否访问http://localhost:8080/(Y/N) 
if "%isweb%"=="Y" start http://localhost:8080/
if "%isweb%"=="y" start http://localhost:8080/

cd ..