C# 执行运行命令-调用ShellExecute

方法:
[DllImport("shell32.dll")]
        public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilder lpszParams, StringBuilder lpszDir, int FsShowCmd);


使用:
//清理全部浏览器历史记录
Utils.ShellExecute(IntPtr.Zero, new StringBuilder("open"), new StringBuilder("rundll32.exe"), new StringBuilder("InetCpl.cpl,ClearMyTracksByProcess 255"), new StringBuilder(""), 1);

你可能感兴趣的:(C#)