I want to execute the program in the .NET server side code.
So far I have this:
process p = new process (); P.StartInfo.FileName = "myProgram.exe"; P.StartInfo.Arguments = "& lt; Parameter list here>"; P.Start (); P.Close (); What is a console program that opens without having to open the console and is closed again.
you want,
process p = new process (); P.StartInfo.FileName = "myProgram.exe"; P.StartInfo.Arguments = "& lt; Parameter list here>"; P.Start (); P.WaitForExit (); What happens in your code is that you start the process and you immediately turn it off, what do you expect forExit () to actually stop the process on its own. Waiting,
To print the output before the app is closed:
process p = new process (); P.StartInfo.FileName = "myProgram.exe"; P.StartInfo.Arguments = "& lt; Parameter list here>"; P.StartInfo.UseShellExecute = false; P.StartInfo.RedirectStandardOutput = true; P.Start (); P.WaitForExit (); Console.WriteLine (p.StandardOutput.ReadToEnd ());
Comments
Post a Comment