0
以下是我的代码。 我的代码中是否有错误或遗漏?如何在C#中运行tracetcp并获取输出结果?
using (Process p = new Process())
{
string strCmdText = string.Empty;
p.StartInfo.FileName = "CMD.exe";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = "tracetcp vrtpmkap2001:445";
p.Start();
string q = string.Empty;
while (!p.HasExited)
{
q += p.StandardOutput.ReadToEnd();
}
string r = q.ToString();
}
我无法得到tracetcp的输出。