Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Automatically run a .bat file?

TH
8 - Asteroid

I am working on a workflow to create an app to do some simple windows shell commands. (Yes I know that the file name calls it a "macro". I know that's not correct. No need to change the file name right now.)

I figure the best way is to get one command to work and then just add sections to the app as needed.

Currently I'm trying to get the "rename" flow to work correctly.

At a base level, the app/flow (attached) takes in the file path and the new file name, does some string manipulation, and writes out a .bat file to the default location. The .bat file contains the shell command with explicit file paths, so that it can address the correct file without having to be in the same location. At this point I *want* it to just run the .bat file.

I can't rely on any user having access to a particular file location, and that's why I put the .bat file in the default location.

 

The problem I'm running into is that when I run the flow as an analytic app, put in the inputs, and click "finish" then it will run through the app, create the .bat file, and ask the user whether the person wants to "Open the following output files:" (see pic 1). (There's only one, and it's the .bat file that I created). If the user does not specifically agree to run the created .bat file then me command doesn't get run.

 

Yes I have gone to the workflow configuration screen, opened up the "Events" tab, and told Alteryx to run the batch file when the worflow finishes (see pic 2). Whether I do this or not appears to make no difference.

 

How do I get this to work?

What do I need to do to make Alteryx run the .bat file without prompting the user?

3 REPLIES 3
Amit_G_Limbasia
8 - Asteroid

You can use Run command tool at the last step insted of creating bat file.

You can find run command tool under developer Check the given example and you can run any command using that.

 

ChrisTX
16 - Nebula
16 - Nebula

The attached workflow contains two examples to call a BAT file:

   Rename an existing file and move it to an Archive folder

   Delete files from an Archive folder if the file's last access date is more than 90 days from current date

 

The BAT file is written to and run from %Engine.TempFilePath%

 

Chris

TH
8 - Asteroid

Thank you, ChrisTX. Knowing the syntax and configuration to use the Run Command tool that way was what I needed.

Amit, I see where your post was going. Seeing what you meant would have helped me, though.

Labels