I have a run command script that copies a file to a new location... How come the result is fine but still getting error code 1? Is there a known way to see what this means?
Can you share the workflow?
Are you using robocopy in your command by chance?
Generally, a batch file exit code 1 means something went wrong, but robocopy uses exit code 1 to mean that a file was copied successfully which can cause confusion.
You can append EXIT /B as the last line of your batch file to exit the batch file before exit codes are report and it should clear that error.
@SPetrie i dont use robocopy - but using the EXIT B/ seems to get rid of the error.. do you know why?
Its the same reasoning even if you dont use Robocopy. Robocopy is just the normal culprit that I see.
The EXIT command terminates the batch script and /B allows us to set an error code. With no code afterwards, its just jumping to the end of the batch file and closing the cmd window without altering the error level/exit code.
Be aware that this code may prevent actual errors from being reported back to your run command tool.
It is a bit odd if you are not using Robocopy that you are getting an exit code of 1. Usually that means that something at least partially went wrong.
If you run the batch in a regular cmd window without alteryx, are there any error messages that pop up?
@SPetrie no error msgs outside alteryx. Its just moving a file/copying a file.
@wonka1234 The only other things I can think of that would cause that error on a successful copy, is in how the commands are being written to the batch file.
When you set it up, is it saving the batch as a csv with no delimiters?
Try opening the batch that is created and see if that has any odd characters in it.
You can run the created batch to see if it generates any errors as well. You can edit the file and add "Pause" as the final command to keep the window open until you enter a keystroke.
You can also try to output the results directly from the batch as well to see if it indicates anything strange using output commands
copy c:\filelocation\test.txt c:\destination > c:\testresults\result.txt
echo "The error level is %errorlevel%"> c:\testresults\errorlevel.txt
Beyond that, Im not sure why it would give you the issues and would need to see the batch created by alteryx.
You can also, if you are confident that its actually doing what you want, leave the Exit /B in the code to simply skip the errors and move about your day.
That call is up to you though.