Run DOS Command

Verb: runDOSCommand

Runs a DOS command in the given directory.

Syntax

runDOSCommand --command(String) [--directory(String)] (String)=output (String)=error

Inputs

Script Designer Required AcceptedTypes Description
--command Command Required Text DOS command that should be executed.
--directory Directory Optional Text Directory where the DOS command should be executed.

Outputs

Script Designer AcceptedTypes Description
output Output Text Output from the executed DOS command.
error Error Text Error returned if command execution fails.

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 Robotic Process Automation- 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"

See Also

  • PowerShell Command
  • Run Windows Script