Error: “The external program "<PROGRAM_NAME>" returned an error code: 1”
Environment Details
The Run Command tool calling a batch file returns the following error if Windows robocopy command is used:
The external program "<PROGRAM_NAME>" returned an error code: 1
- Alteryx Designer
- Windows robocopy command
image.png Cause
The robocopy command generates a detailed report after the command is executed and this causes an issue with the Run Command tool.
Here is an example of the report:
image.png
Resolution
To prevent the Run Command tool from throwing an error, please include "exit /b" command in the batch file after the robocopy command to exit the script.
Here is an example of a batch file:
mkdir c:\temp\createforfun
ROBOCOPY "C:\temp\FromMe" "c:\temp\createforfun" /MIR /log:robolog.txt
exit /b
Note: The /log option is added in the above example to check the status of the robocopy command. This is optional.
Additional Resources