Execute OS Command

The tool “Execute OS Command” can schedule commands on the local operating system. Those commands must be specified by using input parameters. Several input parameters will be concatenated to a single command string using the input parameter separator attribute as the delimiter.

If a program or a batch file was called by the OS Command, AWM can parse its return values, as long as they obey certain syntax rules (see the following table).

Syntax Meaning Example
ReturnCode: <returncode> Return code of the tool (default: 0) ReturnCode: 12
Message: <message> Tool message to be displayed in a dialog box (optional) Message: File %1 was not found!
LogMessage: <message>

Log messages will be shown in the Eclipse Error Log View after the tool was executed. (optional)

LogMessage: Creating file “%filename%”…
OutParm: <parameters> Output parameters of the tool which must be returned at the very end. Output parameters are optional, but the number of parameters must match with the modeled output parameters. Also, the parameter separator must match with the separator defined in the AWM tool descriptor. OutParm: value1 value2

The return code indicates whether the called program or batch file executes successfully or ends with warnings or errors. If the return code is higher than 0, a message should also return. If the return code is higher than the maximum allowed return code (see Application Options),an error dialog box appears displaying the tool messages, and the action in which the tool executes is aborted.

Messages returned by the OS command will always show up in a dialog box in the client after the action was executed. As long as the return code is lower than the maximum allowed return code, returned messages from all tools will be collected and shown after the action is finished.

Output parameters must be returned at the very end. Note that Microsoft Windows batch files automatically "echo" every statement, which can cause problems when returning output parameters. Therefore Micro Focus strongly recommends to disable statement echoing by using the "@echo off" statement in the batch file.

This example shows a Windows batch file that returns a message, return code and an output parameter:

      
      
@echo off 
… 
echo ReturnCode: 4 
echo Message: No customers found for the given filter %1. 
echo OutParm: %~dp0customers.txt