Calling another application in C#

Include System.Diagnostics namespace.Process proc = null;ProcessStartInfo procInfo = new ProcessStartInfo("Notepad.exe");procInfo.UseShellExecute = false;proc = Process.Start(p

ITPro Today

October 6, 2004

1 Min Read
ITPro Today logo

Include System.Diagnostics namespace.

Process proc = null;
ProcessStartInfo procInfo = new ProcessStartInfo("Notepad.exe");
procInfo.UseShellExecute = false;
proc = Process.Start(procInfo);
proc.WaitForExit();

Create objects for Process and ProcessStartInfo.

In ProcessStartInfo specify the application to run.

procInfo.UseShellExecute = false;

this line is to indicate whether to use the operating system shell to start the process.Default value is true.

procInfo.CreateNoWindow = true;

Indicates to start the process in new window.

proc = Process.Start(procInfo);

It will start the process and wait indefinitely for the process to exit.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like