title: C# Command-Line Parsing of Quoted Paths and Avoiding Escape Characters
body: <p>How is it possible to parse command-line arguments that are to be interpreted as paths?   args[] contains strings that are automatically joined if they are quoted, e.g.:</p>
  
  <p>example.exe one two "three four"</p>
  
  <pre><code>args[0] = one
  args[1] = two
  args[2] = three four
  </code></pre>
  
  <p>However, args[] will not property parse "C:\Example\" as an argument.  Rather, it will supply the argument as "C:\Example""  (with the extra quote included.)  This is due to the backslash in the path being treated as an escape character and thus the end quotation that the user supplied on the command-line becomes part of the argument.</p>
  
  <p>.e.g:</p>
  
  <p>example.exe one "C:\InputFolder" "C:\OutuptFolder\"</p>
  
  <pre><code>args[0] = one
  args[1] = C:\InputFolder"
  args[2] = C:\OutputFolder"
  </code></pre>
  
  <p>An easy kludge might be:</p>
  
  <pre><code>_path = args[i].Replace("\"", @"\");
  </code></pre>
  
  <p>However, I'm sure there is a best-practice for this.  How might one correctly parse a command line that inlcudes paths, preventing the args[] array from improperly being populated with stings that have been parsed for escape characters?</p>
  
  <p>NOTE: I would not like to include an entire command-line parsing library in my project!  I need only to handle quoted paths and wish to do so in a "manual" fashion.  Please do not reccomend NConsoler, Mono, or any other large "kitchen sink" command-line parsing library.</p>
  
  <p>ALSO NOTE:  As far as I can tell, this is not a duplicate question.  While other questions focus on generic command-line parsing, this question is specific to the problem that paths introduce when parts of them are interpreted as escape sequences.</p>