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 a batch file from Run Command tool

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!

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

 

Alteryx Certified Partner

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 wrote:

Your command must not be returning 0.

 

Just add

 

exit 0

 

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


 

Alteryx Partner

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.

Alteryx Partner

@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.

Meteor

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

 

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