hi all,

I liked the redirection stuff chris cells posted lasted week, and I have set
about trying to redirect the output of telnet, (a console app on xp).

I have ripped off chris's code (changed 'cmd.exe' to 'telnet.exe') :

// Create cmd.exe, turning off the window and redirecting I/O to us
ProcessStartInfo    info = new ProcessStartInfo("telnet.exe");
info.CreateNoWindow = true;
info.RedirectStandardError = true;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.UseShellExecute = false;
cmdProcess = Process.Start(info);

// Capture I/O
errorReader = cmdProcess.StandardError;
outputReader = cmdProcess.StandardOutput;
inputWriter = cmdProcess.StandardInput;
inputWriter.AutoFlush = false;

However nothing ever starts up, or if it does it then it quickly closes
again and nothing comes through the redirected output.

if I put in a check for cmdProcess.HasExited after the Process.Start it
always returns true.

if i comment out the 3 redirection lines then telnet starts up but it
defeats the object of trying to do the redirection in the first place!

I don't know whats wrong. Is this a security thing perhaps?

bg

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to