参考链接:https://www.jb51.net/article/70779.htm

    调用RunDll32.exe

    1. RunCmd("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8");
    2. //Temporary Internet Files (Internet临时文件)
    3. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
    4. //Cookies
    5. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
    6. //History (历史记录)
    7. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
    8. //Form Data (表单数据)
    9. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
    10. //Passwords (密码)
    11. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
    12. //Delete All (全部删除)
    13. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
    14. //Delete All (同时删除加载项存储的文件和设置)
    15. //RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
    16. void RunCmd(string cmd)
    17. {
    18. System.Diagnostics.Process p = new System.Diagnostics.Process();
    19. p.StartInfo.FileName = "cmd.exe";
    20. // 关闭Shell的使用
    21. p.StartInfo.UseShellExecute = false;
    22. // 重定向标准输入
    23. p.StartInfo.RedirectStandardInput = true;
    24. // 重定向标准输出
    25. p.StartInfo.RedirectStandardOutput = true;
    26. //重定向错误输出
    27. p.StartInfo.RedirectStandardError = true;
    28. p.StartInfo.CreateNoWindow = true;
    29. p.Start();
    30. p.StandardInput.WriteLine(cmd);
    31. p.StandardInput.WriteLine("exit");
    32. }