@echo off


setlocal enableextensions
if exist Pn\Config.cmd pushd . & goto cfg
if exist ..\Pn\Config.cmd pushd .. & goto cfg
goto :eof

:cfg
call Pn\Config.cmd
prompt -$g

if not exist %apadir%\logs\httpd.pid goto startsvc

goto end

:startsvc
%pl% upcfg(); || %pause% && goto end
%pl% chport(%htd_port%); || %pause% && goto end
if not exist %SystemRoot%\Temp\session.save_path md %SystemRoot%\Temp\session.save_path
pushd %apadir%
bin\httpd.exe -k install -n %htd_svc%
set errno=%errorlevel%
bin\httpd.exe -k start -n %htd_svc%
set /a errno=%errno% + %errorlevel%
popd

if %errno% GTR 0 %pause%

:end
prompt
popd
