How to control a process launched with Process.start(string)

G

Guest

I launch an application using this method:

Process.Start("C:\\Documents and
Settings\\Ramón\\Desktop\\C#___Bluegurads_v3_18_03_05\\Bluetime_1\\BlueTime\\Debug\\BlueTime.exe");

but then I do not know how to wait until it is finished.
anybody knows how to do it?

Thanks, Ramón
 
C

Claire

private void DownloadFirmware(object sender)
{
string fnName = "DownloadFirmware";
string FileName = Globals.ApplicationPath + "\\SerDL.exe";
// Look for SerDl
if (File.Exists(FileName) == false)
{
MessageBox.Show(string.Format("File '{0}' was not found", FileName));
return;
}
if (sender == cmdInstallFirmware)
{
try
{
System.Diagnostics.Process SerDL = new System.Diagnostics.Process();
SerDL.StartInfo.FileName = FileName;
SerDL.StartInfo.WorkingDirectory =Globals.ApplicationPath + "\\Firmware";
SerDL.StartInfo.UseShellExecute = false;
SerDL.Start();
SerDL.WaitForExit();
}
catch (Exception f)
{
Log.Error(GetType(), fnName, f);
MessageBox.Show(@"Exception occurred while attempting to run SerDl.exe
"+f.Message, "Error");
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top