C # calling Process

Source: Internet
Author: User

Process Process =NewProcess (); Process. Startinfo.filename="123.exe"; Process. Startinfo.useshellexecute=false;//whether to use the shellProcess. Startinfo.createnowindow =true;//whether to start the value of the process in a new windowProcess. Startinfo.redirectstandardinput =true;//REDIRECT input streamProcess. startinfo.redirectstandardoutput=true;//REDIRECT output streamProcess. Startinfo.redirectstandarderror=true;//REDIRECT error streamprocess.            Start (); Process.            Standardinput.writeline (TextBox1.Text); Process.            Standardinput.writeline (TextBox2.Text); TextBox3.Text=process.            Standardoutput.readline (); Process.            Standardinput.writeline (TextBox1.Text); Process.            Standardinput.writeline (TextBox2.Text); Textbox4.text=process.            Standardoutput.readtoend (); Process.            WaitForExit (); Process. Close ();


Using process to invoke an existing program Process.StartInfo.FileName = "123.exe", to indicate which program to run (if it is not in the same folder to specify the path), through StartInfo can also set other properties such as

Process.   Startinfo.createnowindow = true; Whether to start the value of the process in a new window
Process.  Startinfo.redirectstandardinput = true; REDIRECT Input stream
Process.  startinfo.redirectstandardoutput= true; REDIRECT Output stream
Process.  Startinfo.redirectstandarderror= true; REDIRECT Error stream

such as

After you set it up, run the process. Start ();

Finally, the program ends and the process is closed. WaitForExit (); Process. Close ();

C # calling Process

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.