Welcome to the Alteryx Knowledge Base

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

Created/Edited - 12/6/2024 by Clara Boo | Alteryx

Summary
The Run Command tool calling a batch file fails with an error if Windows robocopy command is used.
Environment

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


Cause

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:

Resolution

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 Information

Additional Resources

Was this article helpful?