Get exit of an application lauched by a C# application

  • Thread starter Thread starter JohnsonBruno
  • Start date Start date
J

JohnsonBruno

Hi,
I want to run an application from a C# program and get its exit
code. Please give me pointers for this.

Regards,
JBruno
 
Hi Bruno,

static int Main()
{
return 0;
}

Look for "Process.ExitCode" if you want more info.

HTH
Marcin
 
If you want the return value of the process you have started:

Process compiler = new Process();
compiler.StartInfo.FileName = "csc.exe";
compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
Console.WriteLine(compiler.StandardOutput.ReadToEnd());
compiler.WaitForExit();

Gabriel Lozano-Morán
 
Back
Top