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

Run a batch file from Run Command tool

StephenMack
10 - Fireball

Ok, so because the email tool doesn't include authentication I've been forced to write my own email workaround

 

- I have a workflow that spits out a report in HTML

- I wrote an EXE that takes in the HTML (with inline images) and processes it to be the body of the email, and finally sends the message

 

It looks like the run command can't accept an input string as a command for example:

SMTP_Command.exe "From@email.com" "To@email.com" "subject"

 

So I have my workflow outputting the appropriate string to a batch file and I'm trying to open that.

 

But now I'm even confused as to how I can run this batch file. I absolutely can't wrap my head around Write source, read source, etc. I just want to write this string to a command line and be done with it. No matter what I try I get some type of error that and input or output needs to be configured.

 

Thanks everyone!

 

Side note: alteryx please fix the email tool, this is a ridiculous amount of side work to be doing just because you didn't include SMTP authentication.

16 REPLIES 16
StephenMack
10 - Fireball

Looks like I got it. Since alteryx is running the script from it's own spot on the hard drive (C:\program files\alteryx or whatever) it breaks the batch script.

 

My string was only

Myprogram.exe "arg1" "arg2" "arg3"

 

but from outside that directory there is no Myprogram.exe, but when I click the link it runs the file from within the correct directory.

 

I changed the string I generated to hold the full path of the batch file.

 

FINALLY THERE! Thanks for the support and quick replies guys!

abhinabaroy09
7 - Meteor

Hi Adam,

 

I want to run a batch right after the input data is read. The batch will simply rename a file (please not that the output of the workflow will create a file with the same name) and move it to a folder, the batch file reads as below

 

 

::Batch file for moving the existing

cd Desktop\test

::Renames the file by attaching yesterdays date as suffix

set /a day=%date:~7,2% - 1
ren date.txt date_%date:~10,4%%day%%date:~4,2%.txt

::Move the renamed file to the archive folder

move date_%date:~10,4%%day%%date:~4,2%.txt archive

I am trying to use the 'Block Until Done' and the 'Run Command' tool as below

 

Capture.JPG

The run command tool does not have anything to do with the input tool and the batch is independent of it.

 

Can we have a workflow which will first run a batch file first and then go about working through the rest of the workflow?

 

Thanks,

Abhinaba

 

markusyk
7 - Meteor

Aaah! Great! Really saved my day.

 

This is needed. Otherwise Run Command returns error and execution stops. With this you can handle error states by yourself later on your workflow.

 

Thanks Adam!

 


@AdamR_AYX wrote:

Your command must not be returning 0.

 

Just add

 

exit 0

 

at the end of the batch file to force a 0 return


 

srini
7 - Meteor

I know it’s tricky!

Block Until Done is not setup to sequence the downstream. It exists only to ensure all upstream records are processed before starting downstream. The fact that they provide 3 downstream forks is merely emperical. Typically designers think about checking, executing and notifying when a complete set of records is processed.

 

To sequence your tools you merely have to put the first tool then the block until done and then the second tool.

 

Hope this helps.

srini
7 - Meteor

@abhinabaroy09 wrote:

Hi Adam,

 

I want to run a batch right after the input data is read. The batch will simply rename a file (please not that the output of the workflow will create a file with the same name) and move it to a folder, the batch file reads as below

 

 

::Batch file for moving the existing

cd Desktop\test

::Renames the file by attaching yesterdays date as suffix

set /a day=%date:~7,2% - 1
ren date.txt date_%date:~10,4%%day%%date:~4,2%.txt

::Move the renamed file to the archive folder

move date_%date:~10,4%%day%%date:~4,2%.txt archive

I am trying to use the 'Block Until Done' and the 'Run Command' tool as below

 

Capture.JPG

The run command tool does not have anything to do with the input tool and the batch is independent of it.

 

Can we have a workflow which will first run a batch file first and then go about working through the rest of the workflow?

 

Thanks,

Abhinaba

 



I know it’s tricky!

Block Until Done is not setup to sequence the downstream. It exists only to ensure all upstream records are processed before starting downstream. The fact that they provide 3 downstream forks is merely emperical. Typically designers think about checking, executing and notifying when a complete set of records is processed.

 

To sequence your tools you merely have to put the first tool then the block until done and then the second tool.

 

Hope this helps.

martman
8 - Asteroid

Hi Adam

 

Im trying to set up a run command to mount a network drive when run by the desktop scheduler, somthing lke this

net use Z: \\computer_name\share_name /PERSISTENT:YES

Do you know if it can be done?

 

Thanks

 

djodts
8 - Asteroid

I am having the exact same issue.  The bat file is correctly populated and if I manually double click it, it runs as expected.  However, Alteryx isn't running it.  I think my error is in the yellow highlight.  StephenMack, were you able to figure this out for yourself?

 

clipboard_image_0.png

Labels