在C#中可以通过Process来启动一个进程,Process位于System.Diagnostics命名空间。
下面来看一个具体实例:
1
2 using System;
3 using System.Diagnostics;
4
5 namespace csharp_station.howto
6 {
7 /**//**//**//// <summary>
8 /// 在C#中启动IE进程
9 /// </summary>
10 class ProcessStart
11 {
12 static void Main(string[] args)
13 {
14 Process ie = new Process();
15
16 //指定启动程序的名称
17 ie.StartInfo.FileName = "iexplore.exe";
18 ie.StartInfo.Arguments = "www.g.cn";
19
20 ie.Start();
21 }
22 }
23}
2 using System;
3 using System.Diagnostics;
4
5 namespace csharp_station.howto
6 {
7 /**//**//**//// <summary>
8 /// 在C#中启动IE进程
9 /// </summary>
10 class ProcessStart
11 {
12 static void Main(string[] args)
13 {
14 Process ie = new Process();
15
16 //指定启动程序的名称
17 ie.StartInfo.FileName = "iexplore.exe";
18 ie.StartInfo.Arguments = "www.g.cn";
19
20 ie.Start();
21 }
22 }
23}
通过上述程序就可以打开IE进程,浏览Google主页!