C# can I add the command prompt control to my app – Education Career Blog

Title says it. I know I can use Process or ProcessStartInfo to run arguments, but I mean actually adding a command prompt control to my app (because I use it very often and it’d be convenient if it was already built-in.

Is there any way to do this other than coding a custom control? If not I can live with it, but it would definitely help.


Something like this (not tested):

ProccessInfo pi = new ProccessInfo("cmd.exe");
Process cmd = Process.Start(pi);
textBox1.Text = cmd.StandardOutput.ReadToEnd();

Watch out for deadlocks, those method can be blocking!

You can also use this solution from codeproject.com: http://www.codeproject.com/KB/miscctrl/commandprompt.aspx


See this question and related. Also this source code for example.

You can start a console near your win app’s window which you will control and can output some data or get input from a user.


What is the problem with doing Console.ReadLine()/Console.WriteLine() in a loop? It is the most efficient way and you have fully control over what you are doing.

Leave a Comment