Page 1 of 2

some help to run a batch in the command executor

Posted: Tue Apr 16, 2019 9:38 am
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

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

Posted: Tue Apr 16, 2019 10:45 am
by emcodem
Hey Ghatis,

it should work like that:

Code: Select all

cmd /C "D:\INGEST\PANIER\mybatch.bat "%s_source%""

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

Posted: Wed Apr 17, 2019 6:30 am
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

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

Posted: Wed Apr 17, 2019 5:50 pm
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

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

Posted: Thu Apr 18, 2019 7:37 am
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.

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

Posted: Thu Apr 18, 2019 10:41 am
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 ?

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

Posted: Thu Apr 18, 2019 10:51 am
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 :|

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

Posted: Thu Apr 18, 2019 11:12 am
by emcodem
Hey Ghatis,

do you have a windows service named ffastrans* ?

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

Posted: Thu Apr 18, 2019 1:10 pm
by Ghtais
No, I have only the FFAStrans REST-API Service (for the monitor I suppose ? )

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

Posted: Thu Apr 18, 2019 1:44 pm
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?