把要执行的cmd命令放入一个bat文件里,然后执行: //Process p = Process.Start(bPath); Process pro = new Process();pro.StartInfo.FileName = bPath;pro.StartInfo.CreateNoWindow = true;pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;pro.Start();…
示例,调用cmd执行PING命令,读取结果,代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace AppUserDocsExecute { class Program { static void Main(string[] args) { Process p = new Process(); p.…