Use command line parameters to start the process, the need to increase the participation in the Main entry [string [] args]
private static void Main(string[] args) { //TODO }
Then, after receiving the parameter args, and then processed.
During processing, if there are multiple places need to use this parameter, it is stored in a global variable
But then, through the guidance of the great God, you can get found by Environment.CommandLine
So I study a little, to do the next record:
// Get command process var cmdInfo = Environment.CommandLine; // value is "D: \ EnvironmentCmdTest.exe" 12345 // Get command string array containing the current process line parameters var info = Environment.GetCommandLineArgs (); // info [0] = "D: \ EnvironmentCmdTest.exe" // info [. 1] = "12345"
Environment.CommandLine acquisition process of the command line, the results obtained are: process path into the reference (Note: This process route is the double quotes)
Environment.GetCommandLineArgs Get command contains the current process line parameters i.e. string array arg [0] for the process path arg [1] of the reference