Run DOS Command
Runs a DOS command in a target directory.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
runDOSCommand --command(String) [--directory(String)] (String)=output (String)=error
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Command | command |
Required |
Text |
DOS command to run. |
Directory | directory |
Optional |
Text |
Specifies the target directory. |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Output | output |
Text |
Output from the DOS command. |
Error | error |
Text |
Returns an error if the command fails to run. |
Example
The DOS command "xcopy" is executed, copying the text file created using the Write to File command to the "My Documents" folder.
defVar --name output --type String
defVar --name executionError --type String
defVar --name myDocumentsPath --type String
defVar --name filePath --type String
defVar --name desktopPath --type String
// Create a file in a random location.
writeToFile --value "IBM Documentation" --createrandomfile filePath=value
// Get the path of the folder "My Documents" and "Desktop".
getSpecialFolder --folder "MyDocuments" myDocumentsPath=value
getSpecialFolder --folder "Desktop" desktopPath=value
runDOSCommand --command "xcopy ${filePath} ${myDocumentsPath}" --directory "${desktopPath}" output=output executionError=error
logMessage --message "${output}" --type "Info"