Process p = new Process(); string path = ...;//bat路径 ProcessStartInfo pi= new ProcessStartInfo(path, ...);//第二个参数为传入的参数,string类型以空格分隔各个参数 pi.UseShellExecute = false; pi.RedirectStandardOutput = true; p.StartInfo = pi; p.Start(); p.WaitForExit(); string output = p.StandardOutput.ReadToEnd();
echo %1 %2 %3 pause