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