Home Search

DriveWorks Pro 22
Run Command Line With Arguments

Send Feedback

Run Command Line With Arguments

This Specification Task will run a Command Line Argument. If a result is generated, it can be returned to a Constant. If an error is generated, it can be returned to a Constant. A timeout can be set, after which DriveWorks will continue to run. If the timeout is reached before the Command Line has fully run, then it will not return a result or error string.

Properties

Property NameDescription
TitleChanges the Title (not the name) of the task.
Command line argumentsSingle string representing all of the Command Line Arguments required
Results ConstantThe name of the Constant that any results string will be posted
Error ConstantThe name of the Constant that any error strings will be posted
TimeoutTimeout in seconds, after which no errors or results will be returned, and DriveWorks will continue. The Command Line will still be executed

Example

When this Task is added the properties are static. To be able to build rules on a static property see How To: Change A Static Property To A Dynamic Property.

Property NameExample RuleExample ResultMeaning
Command Line Arguments"/c notepad.exe C:\MyDocuments\Data\Details.txt"/c notepad.exe C:\MyDocuments\Data\Details.txtThis will open up the Text file Details in Windows Notepad.
Results Constant"DWConstantCommandPromtSuccess"DWConstantCommandPromtSuccessThis is the name of the Constant to report to if the Command ran successfully.
Error Constant"DWConstantCommandPromptFailure"DWConstantCommandPromptFailureThis is the name of the Constant to report to if the Command fails to run.
Timeout55This is the timeout in seconds after which no errors or results will be returned.

Some Command Line Examples

Here are a few examples for the Command line arguments property.

ExampleDescription
/c "C:Program Files\CopyDocuments.bat"Will run the batch file CopyDocuments from the command line when the task is run. Note quotes required when spaces exist in the path.
/c notepad.exeWill run notepad.
/c notepad.exe C:\DriveWorks\Notes.txtWill run notepad and open the text file named Notes.
"/c ""C:\DriveWorks\"&DWVariableProgramToRun&""""Use this example when the name of the program to run is calculated from a variable. Note the opening and closing quote marks. Will run the program calculated from the variable ProgramToRun from the command line when the task is run. This property can be made Dynamic, allowing a variable to be selected from the Rules Builder.
/c echo hello world Will return the string hello world.

Using the Task in a Specification Macro

This task has different types of Outputs. For more information about Outputs see Specification Macros Task Node.

Outputs are only available within Specification Macros. Currently Outputs are not available for Specification Flow.

Status Outputs

This task supports Status Outputs. These can be used to perform different actions depending on what the status outcome of the task is. For more information see Status Outputs in the Task Node Outputs section of Specification Macros Task Node.

The status output navigation is as follows:

Success

  • Command executed successfully.

Success with Warnings

  • N/A - should never be fulfilled.

Failed

  • Command executed but the result contains error message.