some help to run a batch in the command executor

Questions and answers on how to get the most out of FFAStrans
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

some help to run a batch in the command executor

Post by Ghtais »

Hi all

I need some help for a very simple workflow.
I have a bat file in a folder on the disc D:
I want to use a command executor node to run this bat with an argument. The argument is a file picked up by a watchmonitor folder
I have tested manually on CMD dos it works

Here is the command dos that runs manually :

Code: Select all

D:\INGEST\PANIER\mybatch.bat myfile.txt
Can you help me to implement this in a command executor ?

thank you
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: some help to run a batch in the command executor

Post by emcodem »

Hey Ghatis,

it should work like that:

Code: Select all

cmd /C "D:\INGEST\PANIER\mybatch.bat "%s_source%""
emcodem, wrapping since 2009 you got the rhyme?
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: some help to run a batch in the command executor

Post by Ghtais »

Hi Emcodem

Thank you for your help !
Very busy at this moment but I will report as soon as possible if it works or not.
Bye
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: some help to run a batch in the command executor

Post by Ghtais »

Hi

So i have tested and it doesn't work :(
In ffastran it says success without execute my scripte.
I have enabled "Show console" in the command executor but it dosen't show it so I can see if there is an error when the script is ruining.
any idea ?

thx
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: some help to run a batch in the command executor

Post by emcodem »

Hi,
to debug batch stuff i recommend to do 2 steps.
Note that this only works when you have ffastrans not running as a service, otherwise the "Show console" will not work as expected.

Step1: check if your batch is actually executed.
-) create a workflow, insert command executor processor, insert this code as "Command" and make sure "Show console" is checked, then right click - submit file:

Code: Select all

cmd /C "C:\temp\test.bat "%s_source%""
Contents of the test.bat file:

Code: Select all

pause
You should see a commandline window that wants you to press any key to go on.

Step2:
-) If Step1 succeeded, check if the variable %s_source% is handed over correctly to your batch. Change the code of the batch to

Code: Select all

echo %1 > c:\temp\output.txt
pause
After submitting a file to the processor, check the contents fo the txt file c:\temp\output.txt. It should contain the submitted filename enquoted.

Let me know if you succeed.
emcodem, wrapping since 2009 you got the rhyme?
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: some help to run a batch in the command executor

Post by Ghtais »

Hi emcodem

sincerely thank you for your time it helps a lot.
Step 1 is ok, Step 2 is ok, with some adjustments it gives the right argument in the txt file. but It still doesn't work.
My goal now is to figured out how to see the console when FFAstran execute the batch. You say that it must not run as service but how to achieve that ?
Do I need to re-install FFAstran ?
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: some help to run a batch in the command executor

Post by Ghtais »

I did an other test. I enable "log to file" in the workflow properties and run the workflow.
it gives me :

Code: Select all

=PROC=> 2019-04-18 12:42:49.063 on Command executor@AUTOINGEST, PID: 11604 -> Executing: cmd /C "D:\INGEST\PANIER\VENTE.bat Commande_TEST15_2292_du_16-04-2019"
If I copy/paste D:\INGEST\PANIER\VENTE.bat Commande_TEST15_2292_du_16-04-2019 in a commande CMD windows it works, but with FFAstran it doesn't :|
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: some help to run a batch in the command executor

Post by emcodem »

Hey Ghatis,

do you have a windows service named ffastrans* ?
emcodem, wrapping since 2009 you got the rhyme?
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: some help to run a batch in the command executor

Post by Ghtais »

No, I have only the FFAStrans REST-API Service (for the monitor I suppose ? )
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: some help to run a batch in the command executor

Post by emcodem »

yeah, the name is misleading... the "rest api service" will also execute the jobs.
I am pretty sure you have file access permission issues to your batch file, can you test if it works when it is on the c:\ drive?
emcodem, wrapping since 2009 you got the rhyme?
Post Reply