We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

Error: "The external program <PROGRAM_NAME> returned an error code: 1" when using Robocopy command


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
    • Version: All
  • Windows robocopy command




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:



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

5 - Atom

This is such a great solution.... I spent so long trying to figure out how to get this rectified and such a simple fix!!!!
Thanks very much 😁