我得到了错误:" tshark:无效的捕获过滤器"> test1.txt的"用于界面NetToAutomationSlave!"
private void OpenTWireShark()
{
string path = string.Format(@"-i 3 -Y ip.src==192.168.20.100 > test1.txt");
ProcessStartInfo cmdStartInfo = new ProcessStartInfo();
cmdStartInfo.FileName = @"C:\Program Files\Wireshark\tshark.exe";
cmdStartInfo.RedirectStandardOutput = true;
cmdStartInfo.RedirectStandardError = true;
cmdStartInfo.RedirectStandardInput = true;
cmdStartInfo.UseShellExecute = false;
cmdStartInfo.CreateNoWindow = true;
cmdStartInfo.Arguments = path;
Process cmdProcess = new Process();
cmdProcess.StartInfo = cmdStartInfo;
cmdProcess.ErrorDataReceived += cmd_Error;
cmdProcess.OutputDataReceived += cmd_DataReceived;
cmdProcess.EnableRaisingEvents = true;
cmdProcess.Start();
cmdProcess.BeginOutputReadLine();
cmdProcess.BeginErrorReadLine();
cmdProcess.WaitForExit();
答案 0 :(得分:0)
您不能使用> test1.txt
作为参数重定向标准输出。
您需要使用OutputDataReceived
事件中的数据并将其记录到您的txtfile