SET TERM=#TEMPLATE_TERM#
SET LOCALDIR=%IBERDIR%
SET DOUBLECLICK=TRUE
SET NOFATALMSGBOX=TRUE
SET MASTERCAPABLE=FALSE
SET SERVERCAPABLE=#TEMPLATE_SERVER_CAPABLE#
SET IBER_EXE_NAME=#TEMPLATE_IBER_EXE_NAME#
SET @DEBUG=N

:: Iterate through the command line args and set the approprate flags for each
:loop
IF "%~1"=="" GOTO cont
  IF /I "%~1"=="-debug" SET @DEBUG=Y 
SHIFT & GOTO loop

:cont
IF EXIST %LOCALDIR%\TMP\EXITING DEL %LOCALDIR%\TMP\EXITING

IF /I %@DEBUG%==N (
  ECHO Starting %IBER_EXE_NAME% with debug DISABLED
  START /WAIT %LOCALDIR%\BIN\%IBER_EXE_NAME%
)

IF /I %@DEBUG%==Y (
  ECHO Starting %IBER_EXE_NAME% with debug ENABLED
  START /WAIT %LOCALDIR%\BIN\%IBER_EXE_NAME% /DEBUG_COM /DEBUG_COM_DEV
)
