serbart
7th April 2009, 13:54
How can i use shell command on windows enviroment ?

comando =sprintf$("e:\erplnfp3\bin\cancella.cmd")

retshell=shell(comando,1)

This script works on unix enviroment but doesnt' work on windows enviroment?

thanks sergio

george7a
7th April 2009, 14:04
Hi,

You should use run.prog() function (http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_run_baan_prog_run_prog) instead.

I hope it helps,

- George

serbart
7th April 2009, 15:20
Hi ,

I tried to use the command but does not work.

retshell= run.prog("del e:\erplnfp3\bin\prova.txt","",RP_WAIT)

the value of retshell = -1

Thanks.
sergio

george7a
7th April 2009, 15:43
"del" alone is not a command that will work from "start -> run". You will need to put "cmd /c" before it. Example:

run.prog("cmd.exe", "cmd /c del e:\erplnfp3\bin\prova.txt", RP_WAIT)

I hope it helps,

- George

serbart
7th April 2009, 16:40
Hi George,
i would like inform you that i solved the problem with your suggest !!

These are the modify in program script:

comando=sprintf$("cmd /c %s\bin\askitm.bat %16s %1s %-8.8s", getenv$("BSE"),
toupper$(item.f),list.type,toupper$(logname$))

retshell= run.prog("cmd.exe",comando,RP_NOWAIT)



thanks you very much.
serbart :)