You cannot redirect the standard Output using > test1.txt
as argument.
You need to use data from the OutputDataReceived
event and log this to your txtfile
Frage
Im getting the error : "tshark: Invalid capture filter "> test1.txt" for interface 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();
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow