using System.Diagnostics; //引用命名空间 /// <summary> /// 隐藏方式运行DOS命令 /// </summary> /// <param name="command">DOS命令</param> public static void runcmd(string command) { Process process = new Process(); try { process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Arguments = "/c" + command; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; process.Start(); } catch { } }
转载于:https://blog.51cto.com/agilitygod/1419920