tuple9i
27th July 2010, 16:23
I have searched the forums with no results. Here is my problem:

I can easily run a sqlplus script and add it to a BaaN job with good results. However, I can't get a windows batch file (*.bat) to run. I consistently get and error message:

Error -1 in running shell script cmd.exe /c d:\temp\user.bat

What I expect the session to do is shell out to windows, execute the batch script and return to the BaaN shell. I have tried variations on the script callout and placement of the commands in session ttaad5205m000 to no avail. If you have successfully run batch jobs in ttaad5205m000 , please post a reply with how you structure the script callout.

Thank you for your input.

SujithKumar
27th July 2010, 17:02
Another alternate may be using wondows scheduler itself..

tuple9i
27th July 2010, 18:03
If it were a regular BaaN job, I would or use my AutoSYS, but what I need to do is shell out between sessions in a BaaN job, run a batch script and return to the BaaN job.

I can do sqlplus shell outs, but just can't get a batch file to run.

Thanks for the reply.

Hitesh Shah
27th July 2010, 19:06
Try run.prog statement (check this board for the syntax)

tuple9i
28th July 2010, 16:48
Ok Hitesh. I tried it to no avail. Here is the string I am using (may be a syntax error):

run.prog("cmd.exe","/c d:\scripts\ROZTST.bat",RP_WAIT)

This is verbatim with my variables from the BaaN Board examples. I checked permissions on the server and no luck - they are basically wide open. Please note that I am doing all this in session ttaad5205m000 and not in a script.

shah_bs
28th July 2010, 17:21
Not quite sure about this (since ours is Unix backend), but the back-slash is a 'special' character, so maybe you need to do as follows:

run.prog("cmd.exe","/c d:\\scripts\\ROZTST.bat",RP_WAIT)

günther
29th July 2010, 11:39
Just for clarification: Your example >>>run.prog("cmd.exe","/c d:\scripts\ROZTST.bat",RP_WAIT)<<< is code, and you cannot enter code directly in ttaad5205m000.

What you could do is to create a baan session with one field an a form, where you enter your windows command, say "d:\scripts\ROZTST.bat". The program script should at least contain a section "choice.cont.process: / on.choice: / run.prog("cmd.exe", "/c" & form.field, RP_WAIT").

And last but not least, you add this session to a job and run the job. That should work if your baan runs on a windows server. But I've never done that since I'm on Unix.

Günther

sushil
29th July 2010, 14:58
Hi,

I would recommend to do with what gunther says , sample function below - i am on windows , its works good.


function call.bat()
{
ret.r = run.prog("cmd.exe","/c d:\scripts\ROZTST.bat",RP_WAIT)
}

tuple9i
29th July 2010, 18:21
Great information! I will try it today and let you know how it goes.

Shah_bs, Since the BaaN is on a windows platform, I do not need to escape the backslash "\". I use this in other BaaN sessions with no problems - it is a *nix issue. I can run my sqlplus with no problem in BaaN jobs, just can't seem to run a batch session. At least up until now - I have hope that this issue can be resolved since gunther & sushil's posts. I do appreciate all of you responding to my original post - gratefully accepted ;-)

tuple9i
3rd August 2010, 17:47
Well, I feel like a total dummy now ;-)

I have been trying the suggestions that you have proposed, but have been unable to get them to work. I was playing around with the specific information needed by ttaad5205m000 and tried various call outs and actually got one to work just fine.

I was able to run the batch file by merely using the complete path to the batch file and modify the process being called by the batch file to have fully defined paths: i.e.

C:\baan\scripts\TestROZ.bat

this calls E:\baan\baanjobs\somescript.job and any paths in the job are fully defined (e:\temp\results\someresult.log)

I thought I had tried that out earlier, but I didn't fully define the paths in subsequent file locations that the batch file called.

I hope my explanation was clear enough.

Thanks to all who replied to my post.