What do you want to do with the console window? Do you merely want to
provide a command prompt? If so, then you can do this:
Process.Start("cmd.exe");
If you want to communicate between the command prompt and the .NET GUI
application then you'll have a lot more work to do. Without knowing what you
want to do I cannot say any more.
Do something like this (not tested):
ProccessInfo pi = new ProccessInfo("cmd.exe");
pi.RedirectStandardError=true;
pi.RedirectStandardInput=true;
pi.RedirectStandardOutput=true;
Process cmd = Process.Start(pi);
cmd.StandardInput.WriteLine("Dir");
MessageBox.Show(cmd.StandardOutput.ReadToEnd());
Watch out for deadlocks, those method are blocking!
Pengyu Hong said:
I want my .NET GUI program has a window for Console and can communicate with
the Console.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.