rajeev2012
5th June 2007, 19:13
Hi,

I want to execute a commnad line statement at server end (Windows), how may i achieve the same ?

I have tried run.program() but it didn't help me.

inputs appreciated ...

-Raj

george7a
6th June 2007, 08:49
Hi,

Can you please post your code? what did run.prog() return?

You can also check the good old Shell() function (http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_shell)

- George

rajeev2012
6th June 2007, 08:51
PLease have some more details, i hope this will help you guys to put your comments.

I am generating some documents on server side that I want to move to some another server. Hence, I have wriiten an FTP script and have placed it on server ( if I opt to have FTP script on client system then, I will have to copy it on every client system). I have written a shell script to call this FTP scrpt and it works fine on Unix. For WINdows I have written a .bat file (having FTP commands) but I am not able to execute the same. I am trying "run.program" with "ftp -s:filename".

-Raj

george7a
6th June 2007, 08:57
Have you tried the file.mv.across.hosts() function? (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_file_mv_across_hosts) Can you answer the following:

1) Does the *.bat file run ok on Windows when you run it manually?
2) What does run.prog return?
3) Can you please post your code?

- George

rajeev2012
6th June 2007, 11:08
The function file.mv.across() won't work because it doesn't accept login and password (correct me if I am wrong). Hence, I will have to use FTP script.
1) *.bat run ok on window when I run it manually
2) run.prog returns "-1"
3) PLease find below the code
ret = run.prog("ftp -s:" & file.path,"","RP_WAIT")

"file.path" variable has the file name with the complete path.

my FTP script is:

open "111.11.11.11"
test
test12
binary
pwd
put "C:\data1\smb_share\readtable.txt" "/temp/test.doc"
bye

-Raj

george7a
6th June 2007, 11:31
You should execute the ftp command through cmd. Here is the working code:
ret = run.prog("cmd.exe","cmd /c ftp -s:" & file.path,RP_WAIT)
I hope it helps,

- George

rajeev2012
6th June 2007, 12:57
Thank you George.
It worked.

-Raj