// Launch Internet Explorer.
Process ieProc = Process.Start("IExplore.exe", "www.intertech.com");
Console.Write("--> Hit enter to kill {0}...", ieProc.ProcessName);
Console.ReadLine();
// Kill the iexplore.exe process.
try
{
ieProc.Kill();
}
catch{} // In case the user already killed it...
}
The static Process.Start() method has been overloaded a few times. At minimum, you will
need to specify the friendly name of the process you wish to launch (such as Microsoft Internet
Explorer, iexplore.exe). This example makes use of a variation of the Start() method that allows
you to specify any additional arguments to pass into the program’s entry point (i.e., the Main()
method).
C H A P T E R 1 7
Do'stlaringiz bilan baham: |