C#开启一个进程

 

 

Process myProc = null;  
myProc = Process.Start(@"E:\QQ轻聊\Tencent\QQLite\Bin\QQScLauncher.exe");//开启一个进程
myProc.Kill();//关闭一个进程

//从注册表中读取默认浏览器可执行文件路径  
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");  
string s = key.GetValue("").ToString();  
//s就是你的默认浏览器,不过后面带了参数,把它截去,不过需要注意的是:不同的浏览器后面的参数不一样!  
//"D:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -- "%1"  
System.Diagnostics.Process.Start(s.Substring(0, s.Length - 8), "http://blog.csdn.net/testcs_dn");  


Process.Start()方法是开启一个进程。  
 //开启一个进程,使用用系统默认的浏览器   
 System.Diagnostics.Process.Start("explorer.exe", "www.baidu.com");  
 
 //调用系统默认的浏览器   
 System.Diagnostics.Process.Start("www.baidu.com");  

//开启一个进程,使用IE浏览器打开指定页面
System.Diagnostics.Process.Start("iexplore.exe", "www.baidu.com");  
 

 

posted @ 2016-10-25 22:52  水墨晨诗  阅读(3341)  评论(0编辑  收藏  举报