IBM Support

Use of Windows batch files in a Build Forge step

Technote (troubleshooting)


Problem(Abstract)

This technote goes over how to properly use multiple batch files in the same IBM® Rational® Build Forge® step.

Cause

Windows batch files return 0 upon successful completion, which tells Build Forge that the step has succeeded. However, any step commands following a batch file will not be executed due to this.

Example:

The two batch files contain a simple echo of the file name.

Step command:

c:\script1.bat
c:\script2.bat
echo Performed both batches

Build Log:

EXEC script1
EXEC end {c:\build\optimus\Windows_Batch_Files\BUILD_2@optimus-prime] c:\script1.bat c:\script2.bat echo Performed both batches (0)

The two commands after the first batch file do not get started.

.


Resolving the problem

Use the call command to catch any batch file return codes, which will allow Build Forge to continue step processing past the first batch file.

Example:

Step command:

call c:\script1.bat
call c:\script2.bat
echo Performed both batch files

Build Log:

EXEC script1
EXEC script2
EXEC Performed both batch files
EXEC end [c:\build\optimus\Windows_Batch_Files\BUILD_2@optimus-prime] call c:\script1.bat call c:\script2.bat echo Performed both batch files (0)

The call command captured the return code allowing all of the step commands to run.

Document information

More support for: Rational Build Forge
Engine

Software version: 3.8, 7.0, 7.0.1

Operating system(s): Windows

Reference #: 1267028

Modified date: 03 August 2007


Translate this page: