Home » C# Codes

Interact with system processes

25 March 2009 No Comments Posted By:Vivek

For Interacting with system Processes,like start or kill process,.Net provides us with the namespace System.Diagnostics.

System.Diagnostics namespace contains a class Process which provides the functionality to monitor processes connected across a network as well as the local machine

Running another exe file

System.Diagnostics.Process.Start("pathofexefile");
System.Diagnostics.Process.Start("notepad.exe");

Killing a currently running process

Process[] processes = Process.GetProcessesByName("googletalk");
foreach (Process p in processes)
{
Process.GetProcessById(p.Id).Kill();
}

No related posts.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>