(view help text of TestCommandLineArgs.cs as plain text)
TestCommandLineArgs.exe, Version 1.00
Test C# command line parsing
Usage: TestCommandLineArgs.exe [ up to 9 command line arguments ]
Returns: Displays each command line argument on a separate line, first
trying traditional method (parsing string[] args), and if that fails
an alternative method using a regex on Envrionment.CommandLine
Traditional parsing is considered unsuccessful if one of the arguments
contains at least one doublequote, not counting the enclosing quotes.
Return code -1 if no arguments, 0 if traditional parsing succeeded,
otherwise the number of arguments found by the alternative parser.
Example:
TestCommandLineArgs.exe "1 2 3" 4 "D:\" "C:\windows" 12 XYZ
Output:
Command line: "D:\TestCommandLineArgs.exe" "1 2 3" 4 "D:\" "C:\windows" 12 XYZ
Traditional command line parsing: 3 command line arguments:
[0] 1 2 3
[1] 4
[2] D:" C:\windows 12 XYZ (contains doublequote)
Alternative command line parsing: 6 command line arguments:
[0] 1 2 3
[1] 4
[2] D:\
[3] C:\windows
[4] 12
[5] XYZ
Written by Rob van der Woude
https://www.robvanderwoude.com
page last uploaded: 2025-10-23; loaded in 0.0084 seconds