@ECHO OFF
REM
REM This batch file will set (and overwrite) some environment variables when
REM called directly from the commandline or from a batch file.
REM
REM When called using '%COMSPEC% /C' the environment will not be changed.
REM On older Windows Systems like WIndows95 and Windows98 the errorlevel cannot
REM checked after calling this batch file.  
REM

REM
REM Setting Parameters
REM
SET BICSUITE_BATCH_PARAMETERS=%1
:NEXT_PARAMETER
SHIFT
IF [%1]==[] GOTO END_PARAMETERS
SET BICSUITE_BATCH_PARAMETERS=%BICSUITE_BATCH_PARAMETERS% %1
GOTO NEXT_PARAMETER
:END_PARAMETERS

CALL COMMON.BAT
IF [%ERRORLEVEL%]==[0] GOTO PAST_COMMON
SET BICSUITE_BATCH_EXITCODE=%ERRORLEVEL%
GOTO DOEXIT

:PAST_COMMON
REM
REM Set connection info used
REM
SET CONNECTION_INFO=
IF [%WIN_VERSION%]==[WIN_9X] GOTO END_INFO
FOR /F "tokens=1*" %%i IN ('hostname') DO @set HOSTNAME=%%i
SET CONNECTION_INFO=--info "SDMSH[%USERNAME%@%HOSTNAME%]"

:END_INFO
SET BICSUITE_BATCH_EXITCODE=0
SET ERRORLEVEL=
REM
REM Run sdmsh
REM
"%BICSUITEJAVA_TL%" %BICSUITEJAVAFLAGS_TL% -cp "%BICSUITEJAR%" de.independit.scheduler.sdmsh %CONNECTION_INFO% %BICSUITE_BATCH_PARAMETERS%
SET BICSUITE_BATCH_EXITCODE=%ERRORLEVEL%

:DOEXIT
REM
REM Exit depending on windows version
REM
IF [%WIN_VERSION%]==[WIN_NT] EXIT /B %BICSUITE_BATCH_EXITCODE% >NUL
SET ERRORLEVEL=%BICSUITE_BATCH_EXITCODE%

