Description of Sample Command Line Images
I’m a visual thinker, not a language-based thinker. My brain is like Google Images
I created a set of images to help visualize how various command lines are parsed. This page explains these images.
You should first review and understand the two command line parser states that I defined: InterpretSpecialChars and IgnoreSpecialChars.
Consider the following command line:
[Test.exe “First Argument” Second]
This command line is parsed identically by parse_cmdline and CommandLineToArgvW to generate the following arguments:
argv = [Test.exe]
argv = [First Argument]
argv = [Second]
Below is the sample image for this command line.show where the parser is actively looking for whitespace to split the command line (parser state is InterpretSpecialChars). show where the parser is ignoring whitespace (parser state is IgnoreSpecialChars).
Blue lines are drawn around the arguments that are produced.
Numbers along the top marked with Red Arrows indicate characters that the parser will remove (footnotes indicate the reason for removal).
Numbers along the bottom marked with Blue Arrows indicate where the parser changed state (footnotes indicate the reason for the state change). A state change only occurs at a double quote character, and the background color of the double quote character that caused the change indicates the state when the character was read by the parser, not the color of the new state.
Characters marked with a black dot () are literal spaces.
Hovering over the image removes any characters that the parser would remove.
- 3) Switch to IgnoreSpecialChars
- 4) Switch to InterpretSpecialChars
- 8) Single double quote character- Enter IgnoreSpecialChars
- 9) Single double quote character- Return to InterpretSpecialChars