@echo off
REM ----------------------------------------------
echo Deleting firewall rules (old names).
netsh advfirewall firewall delete rule name=NxRelay_53_in > NUL
netsh advfirewall firewall delete rule name=NxRelay_19002_in > NUL
REM -
REM ----------------------------------------------
echo Deleting firewall rules (new names).
netsh advfirewall firewall delete rule name=NxRelay_UDP_53_in > NUL
netsh advfirewall firewall delete rule name=NxRelay_TCP_19002_in > 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 ----------------------------------------------
cscript undns.vbs
net stop %APPNAME%
"%BPATH%nssm.exe" remove %APPNAME% confirm
