community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Run Command Error Code 1

Highlighted
Meteoroid

Hello all -

 

I am THISCLOSE to finishing this workflow which will be a huge help for some of my monthly reports...HOWEVER, I keep getting this error when it gets to the Run Command tool. I haven't used this before so I'm not really sure if I am using this correctly. It opens up the cmd window and won't finish until I close the window. I couldn't find much on this error code, but I probably missed something out there in the Alteryx Universe.

 

Thank you in advance!

 

(screen shot below, workflow attached)

 

Capture.PNG

 

 

Alteryx Partner

Error Code 1 is usually a general term to mean that *something* went wrong in executing the program. This likely means it has to do with the .bat file you're running. Are you sure that you've selected the correct path? If so, do you have visibility into the internals of this command, or have you running into errors before with the .bat file when running it manually? If so, do you think your workflow could be passing something to this program that is causing the same error?

Comet

I think you need to clear your write source because right now you are trying to output a batch file which I don't think you are actually trying to do. Also, try setting the working directory to the folder that your batch file lives in. 

Alteryx Partner

Ah, as the above poster noted, you're overwriting the .bat file with your output. This is probably why its giving you error code 1 after the "Stop Until Done" tool, as it's now trying to execute an excel file, with the extension ",bat" in your command prompt, causing issues and returning an error.

Moderator
Moderator

Hi @rachcamp7,

 

Since I don't have your data, I can only make assumptions based on the workflow here, but I have a few items that may help! It definitely looks like you're on the right track though.

 

First, the Output Data tool above your Run Command appears to be duplicating some efforts. It looks like you want to write out a .bat file and then execute that. The good news is that can be accomplished with only the Run Command tool itself. This is the purpose of the Input anchor on the Run Command tool along with the "Write Source" option.

 

You can think of the Run Command tool as three separate tools working as one.

 

  1. The "Write Source" takes the data from the Input anchor and writes it to a file that you specify in the "Output" options, similar to an Output Data tool. When you have something connected to the Input anchor, you should specify a file here.
  2. The "Run External Program" section then executes the command(s) you specify, which is good because we can execute a file we created in the previous step.
  3. The "Read Results" is similar to an Input Data tool, reading in a file, which is very helpful for reading in data from a command you ran earlier (for example, log files from a process you ran). When you have something connected to the Output anchor of the Run Command, you'd specify a file here to read.

 

So basically, we want to take advantage of 1 and 2 above, writing out your .bat file and then executing it. This will simplify things a bit!

 

Once we have this done, the next step is to find out why your command window never closes. From what I can tell from the workflow provided, it should be a fairly simple copy operation, so unless your data is massive it should be pretty quick! I have a slight hunch that it may be due to the "Write Source" options in your configuration that is writing out a .bat file in the code page of ISO 8859-3 Latin 3. It may be confusing the CMD program, so you could try setting it to Latin 1 instead. Other than that, your configuration looks good, omitting field names and writing out without a delimiter ( \0 ) and as a .CSV format. If this still doesn't work, there might be some problems with the .bat file we're writing out. There might be extra characters in it, such as whitespace in the data or missing quotes, or a problem with the command that is being written to file. You could try running the .bat file manually (outside of Alteryx) by double-clicking it and see if it performs the action you were looking for, or even simply reviewing the .bat file with a text editor to make sure it's got all the right names and quotes in it.

 

One other thought I have is that your Input Data for your template name is only pulling in the name of the file. Your Run Command will execute in the directory that the workflow is executed from by default, so if your template file lives on your desktop and your workflow is running from a different folder, you may have some trouble copying files if you only specify the file name in your .bat file creation and not the full path. You may wish to use full paths in your .bat file creation to avoid issues when the file goes to be copied. This will also help ensure that changes to the workflow or locations of the files won't cause issues later.

 

If we're still stuck, if you can provide the .bat file that the workflow has been creating, it might also help expose the issue! You may have to change the file extension of the .bat file to upload to Community, as a quick note!

Mike Spoula
Support Knowledge Manager
Alteryx
Meteoroid

Hi,

 

Is it possible to use this run command to create/save to, a file path which has blank spaces.  I am trying to create new folders in an existing structure of folders that already have blank spaces in the folder names, however I can only get mine to work if saving into folders without blank space.

 

Thanks

David

Labels