国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C# 中啟動進程的三種方法

2019-11-18 17:10:05
字體:
來源:轉載
供稿:網友
1.啟動子進程,不等待子進程結束
PRivate void simpleRun_Click(object sender, System.EventArgs e)
{ System.Diagnostics.Process.Start(@"C:/listfiles.bat");
}
2.啟動子進程,等待子進程結束,并獲得輸出
 1private void runSyncAndGetResults_Click(object sender, System.EventArgs e)
 2{
 3    System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:/listfiles.bat");
 4    psi.RedirectStandardOutput = true;
 5    psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
 6    psi.UseShellExecute = false;
 7    System.Diagnostics.Process listFiles;
 8    listFiles = System.Diagnostics.Process.Start(psi);
 9    System.IO.StreamReader myOutput = listFiles.StandardOutput;
10    listFiles.WaitForExit(2000);
11   
12    if (listFiles.HasExited) 
13    { 
14        string output = myOutput.ReadToEnd(); 
15        this.processResults.Text = output;
16    }
17}
183.使用默認的瀏覽器打開URL
1private void launchURL_Click(object sender, System.EventArgs e)
2{
3    string targetURL = @http://www.duncanmackenzie.net;
4    System.Diagnostics.Process.Start(targetURL);
5}
http://crush.VEVb.com/archive/2006/06/09/421398.html
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 深泽县| 文安县| 社旗县| 霞浦县| 阜阳市| 沅江市| 锡林郭勒盟| 华坪县| 涟水县| 花垣县| 冕宁县| 河北区| 外汇| 玛纳斯县| 丰镇市| 巴彦县| 兴隆县| 永德县| 绥芬河市| 额济纳旗| 筠连县| 本溪市| 城口县| 溧水县| 和田市| 微山县| 库车县| 体育| 固安县| 辽源市| 界首市| 苏尼特左旗| 衡阳县| 蒙山县| 鲁甸县| 佳木斯市| 鹤山市| 噶尔县| 穆棱市| 林甸县| 溧水县|