@echo off
rem -------------------------------------------------------------------------
rem wremove - remove monitor from memory
rem usage: wremove NN
rem where: NN = network { en, fd, tr }
rem -------------------------------------------------------------------------

rem - work in the Sniffer directory
cd \%1sniff

rem - check if the monitor driver is loaded
if exist \config\%1mon.rem goto unloaded

rem - remove the monitor driver from memory
:loaded
echo Removing the monitor driver from memory...
%1mondrv unload
if errorlevel 1 goto unload_error

:unloaded
if exist \config\%1mon.ins del \config\%1mon.ins
echo removed > \config\%1mon.rem
goto exit

rem - unable to unload the monitor, inform user
:unload_error
echo Fatal Error: Unable to unload the monitor from memory!
echo Re-boot the system and configure the monitor again.
echo If the problem persists, contact Technical Support.
pause
goto exit

rem - back to the menu
:exit
if "%1"=="fd" fixemm clear > nul
cd \
menu
