无效的捕获过滤器

时间:2014-04-17 06:25:29

标签: c# tshark

我得到了错误:" 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();

1 个答案:

答案 0 :(得分:0)

您不能使用> test1.txt作为参数重定向标准输出。 您需要使用OutputDataReceived事件中的数据并将其记录到您的txtfile