Below is an example RED host script which calls a batch file:

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
CALL c:\temp\MyBatchFile.bat > c:\temp\MyBatchFile.log 2>&1
IF %ERRORLEVEL% EQU 0 GOTO LABEL_OKAY
ECHO -2
ECHO Batch file returned an error code of %ERRORLEVEL%
TYPE c:\temp\MyBatchFile.log
EXIT
:LABEL_OKAY
ECHO 1
ECHO Batch file completed successfully
TYPE c:\temp\MyBatchFile.log

Where "c:\temp\MyBatchFile.bat" contains this:

ECHO Hello
SET ERRORLEVEL=0

Create the Host Script in RED:

Edit the Script and enter the following:

Save the Script:

When the script is executed, you will see the following results:

 
 

  • No labels