Write command linesProgramIt is inevitable that the command line parsing rules need to be processed.ArticleHttp://msdn2.microsoft.com/en-us/library/aa2420.1.aspx:
- The parameters are separated by spaces or tabs.
- If a string is enclosed by two double quotes, it is considered a parameter even if it contains spaces or tab characters. The resulting string can be embedded in the parameter.
- The double quotation marks in the string can be escaped using the front backslash.
- The backslash is interpreted as a single character, unless followed by a double quotation mark.
- If an even number of backslashes are followed by a double quotation mark, each pair of backslashes is placed with a backslash In the parameter. The double quotation mark is interpreted as a string delimiter.
- If an odd backslash is followed by a double quotation mark (double quotation mark), each pair of backslash is placed with a backslash into the argv array. The double quotation mark is escaped by the remaining backslash and placed in the argv.CompositionString delimiter.
The parsing workload of these rules is not small, there are a lot of related libraries to help us solve this problem, previously usedMonoA console program auxiliary package provided by the ProjectGetoptionsRecently, a library on codeplex is also very good. We recommend it to you. This function library provides the ability for. Net Applications to parse command column parameters. In addition, it allows you to display customized help windows.
Project address: Command Line parser Library