Objective:
Written so long program, today only know a basic point, is the program entry static void Main (string[] args) in the args parameter is what meaning? Ashamed...
Demand:
Click on a button to launch an EXE program and pass parameters to it.
The code is as follows:
private void btnStart_Click (object sender, RoutedEventArgs e) { var rootpath = system.configuration.configurationmanager.appsettings["RootPath"]; Process.Start (RootPath + "Xxx.exe", "This is the first parameter this is the second argument this is the third parameter"); }
Console code:
public class program { static void Main (string[] args) { Console.WriteLine (string. Format ("{0} parameters received", args.) Length)); foreach (var item in args) { Console.WriteLine (item); }
}
}
Output Result:
Finish!
Passing parameters and receiving parameters to the C # console