when running a program (in this case Cmail.exe) from the commandprompt, I can redirect the output using the commandline
Code: Select all
cmail.exe -config:configfile.txt -d > %temp%\cmail.log 2>&1
However, when I try to do the same with
Code: Select all
cmail=runprogram("cmail.exe","-config:configfile.txt -d","",#PB_Program_Read|#PB_Program_Open|#PB_Program_Error)
output.s=""
If cmail
While ProgramRunning(cmail)
error.s=ReadProgramError(cmail)
If AvailableProgramOutput(cmail)
output+ReadProgramString(cmail)+#CRLF$
EndIf
Wend
exitcode=ProgramExitCode(cmail)
If exitcode=0
Debug("Done")
Else
Debug("ERROR:"+Str(exitcode)+":"+error.s)
EndIf
Else
Debug("Could not start cmail")
EndIf
What am I doing wrong here? The errormessage is the very last message given.