Hello,

1- I want to run a series of commands on cmd.exe from c#.
2- I need to open only one window of cmd
3- I need to keep the cmd window open through the execution and after the completion.
4- I need to display the commands executed as well as the output of the commands.

So basically i want to open and use the cmd.exe just like a manual user would.
I tried some methods, non could do all the 4 items above.

Below code works but does not display the commands/outputs and terminates after completion.
Any help?

Code:
Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
info.RedirectStandardInput = true;
info.UseShellExecute = false;
info.CreateNoWindow = false;
info.Arguments = "/k";

p.StartInfo = info;
p.Start();

        using (StreamWriter sw = p.StandardInput)
        {
                if (sw.BaseStream.CanWrite)
                {
                    sw.WriteLine("dir");
                    sw.WriteLine("ipconfig");
                    sw.WriteLine("connect -r rs_01_lab -d Domain_DELLBANPDB01 -n etl_designer -x etl123");
                }
        }