In my WPF application I am trying to open cmd.exe through System.Diagnostics.Process but every time it hits process.Start() it closes immediately and I cannot write anything else to it. However if I call the static Process.Start() it will stay open but then I am unsure how to write to it. See below.
var processInfo = new ProcessStartInfo("cmd.exe")
{
UseShellExecute = false,
RedirectStandardInput = true,
};
var process = new Process()
{
StartInfo = processInfo,
};
process.Start(); // This close immediately and not work
Process.Start("cmd.exe"); // This will work but can't write to it
process.StandardInput.WriteLine(someText);
process.StandardInput.WriteLine(moreText);