Getting MSDos ErrorLevel

BlitzPlus Forums/BlitzPlus Programming/Getting MSDos ErrorLevel

jp22(Posted 2007) [#1]
Is there a way to get the MSDos %ErrorLevel% variable after calling a process via ExecFile? I just need to know if the program i'm calling has completed successfully. I *think* the current return code from ExecFile indicates if the .exe was executed (valid file path)?

Or, as the ErrorLevel is just the return code from the app itself, is there a way to get this?

Thanks
J


em22(Posted 2008) [#2]
If you use :
command$="cmd.exe /c echo %errorlevel%"
a=CreateProcess (command$)
 
While Not Eof(a) ; repeat loop until process has ended
d$=ReadLine(a)

DebugLog (d$)

Wend 
notify "done"


Should do the trick.


schilcote(Posted 2008) [#3]
api_CreateProcess take about nine parameters. Where are the rest? Or do you mean ExecFile?