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

首頁 > 編程 > C# > 正文

C#啟動進程的幾種常用方法

2020-01-24 01:52:08
字體:
來源:轉載
供稿:網友

本文實例講述了C#啟動進程的幾種常用方法。分享給大家供大家參考。具體如下:

1.啟動子進程,不等待子進程結束

private void simpleRun_Click(object sender, System.EventArgs e){ System.Diagnostics.Process.Start(@"C:/listfiles.bat");}

2.啟動子進程,等待子進程結束,并獲得輸出

private void runSyncAndGetResults_Click(object sender,System.EventArgs e){   System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:/listfiles.bat");   psi.RedirectStandardOutput = true;   psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;   psi.UseShellExecute = false;   System.Diagnostics.Process listFiles;   listFiles = System.Diagnostics.Process.Start(psi);   System.IO.StreamReader myOutput = listFiles.StandardOutput;  listFiles.WaitForExit(2000);  if (listFiles.HasExited)   {     string output = myOutput.ReadToEnd();     this.processResults.Text = output;  }}

3.使用默認的瀏覽器打開URL

private void launchURL_Click(object sender, System.EventArgs e){  string targetURL = @//m.survivalescaperooms.com;  System.Diagnostics.Process.Start(targetURL);}

希望本文所述對大家的C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沛县| 庆安县| 庆元县| 长春市| 海伦市| 吉水县| 临汾市| 长海县| 汉中市| 曲沃县| 舟曲县| 苏尼特左旗| 沁水县| 石城县| 辰溪县| 鲁山县| 遂昌县| 泾川县| 眉山市| 莱州市| 疏附县| 华亭县| 鹤岗市| 清镇市| 长春市| 松滋市| 丰原市| 新安县| 天津市| 高青县| 盖州市| 乐安县| 大石桥市| 卓资县| 余姚市| 长宁区| 汉阴县| 玉门市| 杂多县| 黎平县| 千阳县|