Code:
public static void workerThread()
{
ProcessStartInfo exec = new ProcessStartInfo("cmd.exe");
exec.RedirectStandardInput = true;
exec.RedirectStandardOutput = true;
exec.RedirectStandardError = true;
exec.UseShellExecute = false;
Process p = Process.Start(exec);
System.IO.StreamWriter streamWriter = p.StandardInput;
System.IO.StreamReader streamReader = p.StandardOutput;
streamWriter.WriteLine("thread started");
for (int i = 0; i < 10; i++)
{
streamWriter.WriteLine("Time is..{0}",DateTime.Now.TimeOfDay.ToString());
Thread.Sleep(500);
}
streamWriter.WriteLine("Thread Closing");
streamReader.Close();
}
I'm having a hard time on this one. It seems it doesn't show the console window with text in it.
Is there a way to sort this out?
What I want is to output a certain text in another console window just for monitoring of process resources.
tnx,
ta3