I have a windows form that executes a batch file. I want to transfer everything that happends in my console to a panel in my form. How can I do this? How can my DOS console comunicate with my windows form panel???
Thanks
解决方案
You can call the DOS or batch program from your Form application and redirect the output to a string:
using (var p = new System.Diagnostics.Process( ))
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = PathToBatchFile;
p.StartInfo.Arguments = args;
p.Start( );
string o = p.StandardOutput.ReadToEnd( );
p.WaitForExit( );
}