@echo off
REM ----------------------------------------------
echo Deleting firewall rules we added.
netsh advfirewall firewall delete rule name=NxProxy_68_in > NUL
REM -
REM ----------------------------------------------
echo Adding firewall rules.
netsh advfirewall firewall add rule name=NxProxy_68_in protocol=UDP dir=in localport=68 action=allow > NUL
REM -
REM ----------------------------------------------
set BPATH=%~dp0
cd %BPATH%
REM -
if not exist ..\conf\appname (
  echo [ERROR] No appname file.
  exit /b 1
)
set /p APPNAME=<..\conf\appname
REM -
REM ----------------------------------------------
"%BPATH%nssm.exe" install %APPNAME% "%BPATH%\startup.bat"
"%BPATH%nssm.exe" set %APPNAME% Start SERVICE_AUTO_START
