Command-Line Operation

Occasionally you need to run a Workflow created in Automated Workflow from outside of Automated Workflow - usually to run the Workflow from a batch file, an external program, or the command line. The files BPATask.exe and BPATaskcm.exe (collectively BPATask) exist for this purpose and can be found in the Automated Workflow folder, which is installed by default in ”C:\Program Files\GlobalSCAPE\EFT\AWE\Bin.

Once started, BPATask does not end until the Workflow (specified on the command-line parameter) has finished processing. Once finished, BPATask returns 0 if the Workflow fails to finish properly and 1 if the Workflow was successful.

BPATask accepts several command-line parameters to control its operation.

Taskname: The filename of the Workflow to run. If the Workflow file name includes spaces - it should be surrounded in quotes or improper operation will result. The 1st parameter must be ”Taskname”.

/v:varname1=value1 - Specifies variable(s)/value(s) to pass to the Workflow. Format is semi-colon delimited name=value pairs.

Example 1
: /v:varname1=value1;varname2=value2;varname3=value3.

Since the list is semi-colon delimited, semi-colons are not allowed in the variable name or value to pass. This can be worked around by replacing a semi-colon with another special character before passing it to BPATask. Configure the Workflow to replace it back to a semi-colon at run time using an embedded expression in the Workflow. For example, if an exclamation point were used as a replacement character for a semi-colon, a Set Variable action at the beginning of your Workflow using the expression Replace$(var1, "!", ";") as the new variable data would convert the exclamation points back to semi-colons.

/? - Causes BPATask to display a message box with usage and syntax help.

The two files BPATask.exe and BPATaskcm.exe work exactly the same with the exception of one characteristic. BPATask.exe is a pure Windows application and is designed to run a Workflow and return to a Windows application when the Workflow specified has been completed, whereas BPATaskcm.exe is a  ”r;console application” and is designed to be run from a command prompt or batch file.

True Windows applications will return immediately when run from the command prompt regardless of when they actually finish running; thus, using the original BPATask.exe one would not be able to determine when the launched Workflow finished or retrieve a return code to determine its success or failure. To avoid this behavior, use BPATaskcm.exe, which is designed for use in a console (command line or batch-file) environment.

So why not always use BPATaskcm.exe? When BPATaskcm.exe (a console application) is invoked from a true Windows application (not from the command prompt) it causes a command prompt (AKA DOS box) to appear if one was not already open. This is not visually appealing and can confuse users. The rule to remember is:

Syntax Examples:

Get help

"C:\Program Files\GlobalSCAPE\EFT\AWE\Bin\BPATask.exe" /?

Run a Workflow

"C:\Program Files\GlobalSCAPE\EFT\AWE\Bin\BPATask.exe" "C:\Documents and Settings\All Users.WINDOWS\Documents\My Automated Workflows\check email.aml"

Run a Workflow and pass variables

"C:\Program Files\GlobalSCAPE\EFT\AWE\Bin\BPATask.exe" "C:\Documents and Settings\All Users.WINDOWS\Documents\My Automated Workflows\check email.aml" /v:VARNAME1=VALUE1,VARNAME2=VALUE2