LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get external exe exit code in LabVIEW 5

Hi, I'm trying to figure how if it's possible to get the exit code when calling an external executable from LabVIEW v5,
Thanks.
0 Kudos
Message 1 of 4
(3,217 Views)
If the external application you're running is a command-line program or function (like "ping" for example) you can simply call it such that any data returned to the command line window is written to a file. From within LV you can then read the contents on this file to extract the response. For example, the command line:

ping ftp.ni.com >> c:\test.txt

will ping NI's ftp site and write the result of the ping to the file test.txt in the root directory of the C drive.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(3,217 Views)
Thanks Mike, I've actually solved my problem.
Piping the output of an executable doesn't actually give you the exit code though.
0 Kudos
Message 4 of 4
(3,217 Views)
Hmm, after delving into Windows API I was able to answer this myself.
I was using a "Run Application.vi" (lvwutil??) & this has a dll call to "GetExitCodeProcess". The last call of this function will return (as the last parameter) the Exit code for an executable.

I hope this helps someone - & if I have any more questions I'll answer them later 😉
0 Kudos
Message 3 of 4
(3,217 Views)