Spawn a process and kill it

The following code launches an instance of the browser, waits 15 seconds and then closes it.


using System;
using System.IO;
using System.Diagnostics;
using System.Threading;

public class Temp
{
///
/// Example of creating an external process and killing it
///

public static void Main() {

Process process = Process.Start("IExplore.exe","www.cnn.com");
Thread.Sleep(15000);
try {
process.Kill();
} catch {}
}
}


Comments

Author: Gaurav Aroraa27 Mar 2009 Member Level: Gold   Points : 0

Good one but it may be more descriptive.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: