Tuesday 15 February 2011

Can you execute another EXE file from within a C# console application? -


Can you execute another EXE file from inside a C # console application?

  • Can you pass arguments?
  • Can you retrieve the exit code?
  • like this:

      var proc = new Process (); Proc.StartInfo.FileName = "something.exe"; Proc.StartInfo.Arguments = "-v -s -a"; Proc.Start (); Proc.WaitForExit (); Var exitCode = proc.ExitCode; Proc.close ();  

No comments:

Post a Comment