Forum Moderators: open
ProcessStartInfo is a very useful class to launch a process. Here is the small code sample
using System.Diagnostics;
ProcessStartInfo psi= new ProcessStartInfo();
Process process;
psi.FileName="cmd.exe";
psi.Arguments=@"/C"; // add its arguments to pass the parameters to executable file
psi.UseShellExecute=false;
psi.RedirectStandardOutput=true;
psi.CreateNoWindow=true; // it does not create a visible windows
psi.WorkingDirectory=@"c:\temp"; // if required
process=Process.Start(psi); // starts the process
while (process.HasExited!=true) // wait until it stops
{
}
process.Close(); // close the process