Run Windows Command
Executes a Windows command: use it only for Windows operations. For Linux operations, use Run Shell Script.
Properties
Name | Type | Description | Expression support |
---|---|---|---|
Command |
mandatory |
Command to execute. See How is the command processed?. |
semi-expression |
Working Dir |
optional |
Working directory.
Default value: the current Java process directory (usually value of |
semi-expression |
Wait For |
optional |
Defines whether the task should wait until the job finishes.
Default: |
none |
Expected Return Codes |
optional |
Comma-separated list of integer values representing valid return codes of the command.
Default: |
none |
Log Start Stop |
optional |
If set to |
none |
How is the command processed?
-
The possible variable mapping replacements are performed.
-
An
EXIT %ERRORLEVEL%
instruction is added to the end of the command. -
The entire command value is copied to the temporary script file.
-
The temporary script file is executed using
cmd.exe
(you can find the temporary script in the task resources directory). Using the intermediate temporary script file allows the user to define more sophisticated interpreter-related logic.
Wait For modes
-
waitFor=true
-
The task waits until the run command is done.
-
The returned code is then compared against
expectedReturnCodes
. -
If expected codes do not contain the returned code, the task fails.
-
-
waitFor=false
-
The task only starts up the command and then terminates immediately.
-
That means that there is no valuable return code to compare against
expectedReturnCodes
, therefore this comparison is skipped. -
The task finishes in OK state and the result of the task is set to
-1
("unknown" value).
-
Notes
When you call other scripts from your command, remember to invoke them using the call
syntax (for example, call some_script.bat
).
Otherwise, the called script:
-
Does not return control to the caller once it is done.
-
Does not store the return value to the OS
ERRORLEVEL
property.
Both of these situations prevent correctly setting the result code.
Predefined variables
-
SCRIPT_RESULT_CODE: Contains the result code returned by the script. The variable is set only if:
-
The task was run with
waitFor=true
. -
The task has not failed with exception.
-
<executable class="com.ataccama.adt.task.exec.EwfWinCmdTask">
<command>name</command>
<workingDir>query</workingDir>
<waitFor>true|false</waitFor>
<expectedReturnCodes>0,1</expectedReturnCodes>
</executable>
Use workflow variables in Windows command
If you would like to use workflow variables in a Windows command, use the following syntax:
echo ${workflow_variable_id}
See also the complete example from Workflow Tutorials in ONE Desktop ( Complete Example from 07_03b_Iterator_Set_Child.ewf
|
Was this page useful?