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

首頁 > 開發 > 綜合 > 正文

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

2024-07-21 02:28:58
字體:
來源:轉載
供稿:網友
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}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南部县| 报价| 安庆市| 韩城市| 汤原县| 盐津县| 和平区| 北安市| 板桥市| 祁连县| 城步| 田林县| 中阳县| 会理县| 绥芬河市| 长顺县| 白沙| 五大连池市| 仁化县| 饶阳县| 荔波县| 金川县| 平武县| 墨江| 东丽区| 邻水| 云安县| 卫辉市| 准格尔旗| 衡阳市| 南澳县| 伊通| 濉溪县| 会东县| 朝阳市| 广水市| 许昌县| 蓬安县| 深圳市| 旬邑县| 安宁市|