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

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

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

2019-11-17 04:02:17
字體:
來源:轉載
供稿:網友
1.啟動子進程,不等待子進程結束view plaincopy to clipboardPRint?
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
private void simpleRun_Click(object sender, System.EventArgs e)   
{ System.Diagnostics.Process.Start(@"C:listfiles.bat");   
}  
private void simpleRun_Click(object sender, System.EventArgs e)
{ System.Diagnostics.Process.Start(@"C:listfiles.bat");
}


2.啟動子進程,等待子進程結束,并獲得輸出view plaincopy to clipboardprint?
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;    
    }   
}  
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.使用默認的瀏覽器打開URLview plaincopy to clipboardprint?
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
private void launchURL_Click(object sender, System.EventArgs e)   
{    
    string targetURL = @http://www.duncanmackenzie.net;    
    System.Diagnostics.Process.Start(targetURL);   
}   
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 榕江县| 贵德县| 浮梁县| 齐齐哈尔市| 信阳市| 五寨县| 海安县| 那曲县| 沭阳县| 彭水| 象山县| 赤壁市| 灵山县| 北京市| 霍邱县| 治县。| 丰城市| 黑河市| 五原县| 和静县| 北流市| 手机| 灵川县| 吕梁市| 大荔县| 通榆县| 北流市| 台湾省| 杭州市| 济阳县| 武定县| 新晃| 怀来县| 兴城市| 新巴尔虎右旗| 海淀区| 通城县| 潞西市| 黎川县| 翁源县| 武乡县|