I have a C# console application (A). I want to execute other console app (B) from within app A (in synchronous manner) in such way that B uses the same command window. When B exists, A should be able to read B’s exit code.
How to do that? I need only this little tip on how to run this other app in same cmd window.
You can use
Process.Startto start the other console application.You will need to construct the process with
ProcessStartInfo.RedirectOutputset totrueandUseShellExecuteset tofalsein order to be able to utilize the output yourself.You can then read the output using
StandardOutput.ReadToEndon the process.