How to start an .exe application using C# console application.
Ans: namespace required is:
using System.Diagnostics;
Process process2 = new Process();
process2.StartInfo.FileName = DestinationPath + "\\" + FileName + "\\AutoUpdater.exe";
process2.StartInfo.Arguments = string.Format("{0}", DestinationPath + "\\" + FileName + "\\AutoUpdater.exe");
process2.StartInfo.CreateNoWindow = true;
try
{
//Start Autoupdater.exe
process2.Start();
if (process2.WaitForExit(180 * 60 * 1000))
{
Console.WriteLine("16. Auto Updater exited normally at " + DateTime.Now.ToString() + "\n");
}
else
{
process2.Kill();
Console.WriteLine("16. Auto Updater exited forcefully at " + DateTime.Now.ToString() + "\n");
}
}
catch (Exception ex)
{
Console.WriteLine("16. error to kill auto updater process, Message: " + ex.Message);
}