【发布时间】:2020-04-30 09:49:19
【问题描述】:
这是我的代码:
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,但这是第二个问题,请先帮我进行防御者扫描。
【问题讨论】:
标签: c# visual-studio cmd process windows-defender