C#에서 프로세스를 시작하는 세 가지 방법

黄舟
풀어 주다: 2016-12-21 14:42:43
원래의
1802명이 탐색했습니다.
  1. 하위 프로세스를 시작하고 하위 프로세스가 클립보드PRint에 대한 일반 복사 보기를 종료할 때까지 기다리지 않습니까?
    ··········10········ ·20········30········40········50·······60·········70·· ······80········90········100·······110·······120········130 ·······140· ······150
    private void simpleRun_Click(개체 전송자, System.EventArgs e)
    { System.Diagnostics.Process.Start(@"C:listfiles.bat ");
    }
    private void simpleRun_Click(개체 전송자, 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.IO.StreamReader myOutput = listFiles.StandardOutput; > if (listFiles.HasExited)
    { string output = myOutput.ReadToEnd();
    this.processResults.Text = output;
    }
    }
    private void runSyncAndGetResults_Click( 개체 보낸 사람, 시스템 .EventArgs e)
    {
    System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:listfiles.bat")
    psi.RedirectStandardOutput =
    psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    psi.UseShellExecute = false;
    System.Diagnostics.Process listFiles;
    listFiles = System.Diagnostics.Process.Start(psi); .StreamReader myOutput = listFiles.StandardOutput;
    listFiles.WaitForExit(2000);

    if (listFiles.HasExited)
    {
    string 출력 = myOutput.ReadTo End(); this.processResults.Text = 출력;
    }
    }


    3. 기본 브라우저를 사용하여 URLview plaincopy를 클립보드 인쇄로 열까요?
    ······· 10·········20········30·······40·········50·········60·········40········· ········70········80·······90········100········110····· ·· 120········130········140·······150
    private void launchURL_Click(객체 전송자, System.EventArgs e) @http://www .duncanmackenzie.net; 세 가지 방법의 내용에 대해 더 많은 관련 내용을 보려면 PHP 중국어 웹사이트(www.php.cn)를 주목하세요!



관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!