这是我的代码:
string damnfile = System.IO.Path.GetDirectoryName(choofdlog.FileName);
ProcessStartInfo startInfo = new ProcessStartInfo("% ProgramFiles %\\Windows Defender\\MpCmdRun.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = "-Scan -ScanType 3 -File" + damnfile;
Process p = new Process();
p.StartInfo = startInfo;
p.Start();
如您所见,我想对特定文件运行 WinDefender 扫描,但它会引发找不到进程的错误,但此代码有效:
ProcessStartInfo startInfo = new ProcessStartInfo("netstat");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = "-a";
Process p = new Process();
p.StartInfo = startInfo;
p.Start();
另外我想在第二个代码中将 cmd 输出重定向到 listBox,但这是第二个问题,请先帮助我进行防御者扫描。