0

我收到错误消息:接口 NetToAutomationSlave 的“tshark:无效的捕获过滤器 > test1.txt”!

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();
4

1 回答 1

0

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

于 2014-04-17T08:06:25.583 回答