Using parameters in batch action

Hi,

What is the right syntax to write a batch command in a run DOS command action that includes parameters in it. For example: echo %MyParameter% > %MyFolder%\MyFile.txt I tried doubling the character, but still getting an error.

Cheers.

Hi,

To add parameters to a run DOS command action, you need to use the same format that would be used if you were running the command from the command window. 

Say you want to run the following myProgram.exe with parameters and this is how you format the call from the command window:

myProgram.exe sourceFile = 'myfolder\myfile.txt’


To execute this through the ‘Run DOS Command / Batch File’ action, you would use the exact same syntax. So the command above would just go straight into the ‘Command / Batch File’ property.


Now lets say that you want to use expressions and variables as parameters. Whenever you use the $my_expression$ or %my_variable% notation, you are telling continua to get the value of that expression/variable and inject it into the command line string. For example, in the expression above, if you want to point sourceFile to the agents workspace, you would use the following syntax.

myProgram.exe sourceFile = '$Workspace$\myfile.txt’

At runtime this will evaluate to:

myProgram.exe sourceFile = ‘<agent_workspace_directory>\myfile.txt’ (for example, myProgram.exe sourceFile = ‘C:\ContinuaAgent\Ws\myfile.txt’)


Note that you do not use the %% and $$ notation for the parameter name. This notation should only be used where you want to inject the parameter’s value.

More information on expressions and variables can be found on our wiki page:

http://wiki.finalbuilder.com/pages/…eId=655772



</agent_workspace_directory>