A System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand;
pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true; pProcess.Start();
string strOutput = pProcess.StandardOutput.ReadToEnd();
pProcess.WaitForExit();
B Process p = new Process();
p.StartInfo.UseShellExecute = true
p.StartInfo.RedirectStandardOutput = false
p.StartInfo.FileName = "YOURBATCHFILE.bat";
p.Start(); string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
C System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("program_to_call.exe");
psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
System.Diagnostics.Process proc System.Diagnostics.Process.Start(psi);;
System.IO.StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit(2000);
if (proc.HasExited) {
string output = myOutput.ReadToEnd();
}
D System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand;
pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WorkingDirectory = strWorkingDirectory;
pProcess.Start();
string strOutput = pProcess.StandardOutput.ReadToEnd();
pProcess.WaitForExit();