ProcessStartinfo处理telnet命令的问题
zhlzl 2006-10-06 03:15:04 我的代码
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine("telnet xxx.xxx.xxx.xxx");
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
为什么在strRst里拿不到telnet命令之后的输出, 或者有什么方法可以周转拿到, 应该在telnet的那台服务器上,我还需要敲入一些命令, 而这些命令也是会有返回值的, 我也希望能拿到这些值, 谢谢