Calling method:
string baseName = (); // baseName+"/" // string fileName = @"C:\Users\59930\Desktop\20170605\WindowsFormsApp1\WindowsFormsApp1\WindowsFormsApp1\bin\x86\Debug\"; string fileName = baseName + @"\"; string para = " " + code; Process p = new Process(); = false; = true; = fileName; = true; = para;//The parameters are separated by spaces. If a parameter is empty, you can pass in "" (); (); string output = ();
Write in the called exe return value
(mmma);
Supplement: The methods of calling external exe in c# are simple and complex.
The easiest thing is to directly use the process class
using ; (" ");
If you want to set it up in detail,
public static void RunExeByProcess(string exePath, string argument) { //Create a process process = new (); //The name of the called exe = exePath; //Pass the parameters of the exe = argument; = false; //Do not display the exe interface = true; = true; = true; (); = true; //Blocking and waiting for the call to end (); }
If you want to get the result returned by the caller, you only need to modify the above slightly to increase the return value:
public static string RunExeByProcess(string exePath, string argument) { //Create a process process = new (); //The name of the called exe = exePath; //Pass the parameters of the exe = argument; = false; //Do not display the exe interface = true; = true; = true; (); = true; string result = null; while (!) { result += () + ; } (); return result; }
The above is personal experience. I hope you can give you a reference and I hope you can support me more. If there are any mistakes or no complete considerations, I would like to give you advice.