Start an external program: [html] using System; using System. collections. generic; using System. linq; using System. text;/* create a process and input the required parameters * or start an external program for the process, and pass in the parameter * Waiting to exit or force close */namespace ConsoleApplication1 {class Program {static void Main (string [] args) {////////// declare a program information class and specify the parameter information of the startup process System. diagnostics. processStartInfo Info = new System. diagnostics. processStartInfo (); // set the external program name Info. fileName = "notepad. Exe "; // set the startup sequence of the program to test.txt Info. arguments = "test.txt"; // set the external program working directory to C: \ Info. workingDirectory = "C: \"; // declare a program class, that is, to create a process System. diagnostics. process Proc; try {// start external program // Proc = System. diagnostics. process. start (Info);} catch (System. componentModel. win32Exception e) {Console. writeLine ("the system cannot find the specified program file. \ R {0} ", e); return;} // print the start time of the external program Console. writeLine ("external program start execution time: {0}", Proc. startTime); // wait 3 seconds for Proc. waitForExit (3000); // forcibly terminate if (Proc. hasExited = false) {Console. writeLine ("the external program is forcibly terminated by the main program! "); Proc. Kill ();} else {www.2cto.com Console. WriteLine (" the external program Exits normally! ");} Console. writeLine ("external program end run time: {0}", Proc. exitTime); Console. writeLine ("returned value when the external program stops running: {0}", Proc. exitCode );}}}