Calling an exe from .NET

  • Thread starter Thread starter db_from_mn
  • Start date Start date
D

db_from_mn

I'm a .NET newbie.
I have a programming tool for a microcontroller that has
support software with a command line interface option.
It's just an .exe with a variety of argument options.
The .exe returns an error code 0 for success, 1 for
failure. It also prints an error message to the screen.
I'd like to interface to this .exe from within my
automatic test fixture, written in C# code, passing
arguments and getting the return value. It would be nice
to get the error message, as well. Is this possible?
Could you provide some general hints or guidelines?
Thanks in advance,
Dennis
 
the System.Diagnostics.Process is the way you want to go. you create a
Process for your
exe and then populate the StartInfo object with the data you need for your
program.

You could even go the extra mile and monitor the HasExitted property to know
when the
exe finishes running.

In my tool I keep track of when the program started and then periodically
check to see if
it is still running or not. If too much time has elapsed I assume the
program has hung, terminate
the process and then generate a warning message.
 
Back
Top