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" <ho**@stat.harvard.edu> wrote in message
news:eK****************@tk2msftngp13.phx.gbl...
I want my .NET GUI program has a window for Console and can communicate
with the Console.
Thank you very much!
Pengyu
"Richard Grimes [MVP]" <read my sig> wrote in message
news:es****************@TK2MSFTNGP10.phx.gbl... Pengyu wrote: Hi,
How to add a console window to a Windows application?
Thank you very much in advance,
Pengyu
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.
Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)