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

Alteryx designer Discussions

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

Run Command with self delete element not working

Asteroid

Hi

 

I have run into an issue using the Run Command tool, any help to resolve would be appreciated.

 

I am using the Run CMD tool to create and execute a command with 3 elements like this example.

 

del "FILE1" del "FILE2" del "%~f0"

 

I have established the problem is with the del "%~f0" command. If the .bat does not include the del "%~f0" command, the FILE1 and FILE2 (these are illustrations) commands execute with no errors. When I add the del "%~f0" command on the end it will not execute and I get the below error:

 

"Error: Run Command (41): The external program "EXTERNAL PROGRAM" returned an error code: 255"

However if I manually create a .bat file with all three elements above and manually execute this, it runs with no errors. Therefore I know the full command works.

 

Is there something with Alteryx that I need to consider here.

 

Thanks,

 

Kevin

Aurora

Hi @KMiller 

 

If you try executing this self deleting batch file from a command prompt, you'll see that there is actually an error message(The Batch file cannot be found) generated at the end.  The command session actually exits with error 255 and that's what Alteryx is catching 

Result.png 

 

When you run from within Windows the message isn't noticeable, since the command window closes so quickly.   

 

There are other ways to make a self deleting batch file that don't return an error, generally involving various un-documented and possibly patched "features" of the OS. I won't provide any links to them here, but  Google is your friend.

 

Dan

 

  

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @KMiller 

 

You could build your command in Alteryx and write it to a temporary batch script.

 

If you Output the Write Source option to %temp%\yourbat.bat, and then run the command from the same path, you will create this script in the TEMP folder. Then, I guess, there's no need of self-deleting it.

 

Cheers,

Asteroid

Thanks @Thableaus that worked well. It also worked on Server which is where this workflow will be used.

 

Kevin

Labels