title: How to parse command line arguments
body: <p>I want to parse a set of command line arguments that look like:</p>
  
  <pre><code>-p[project file path] -s[name 1]=[value 1] ... -s[name n]=[value n]
  </code></pre>
  
  <p>Where there is exactly one project <code>p</code> and any number of settings <code>s</code>.</p>
  
  <p>I have tried using <code>NDesk.Options</code> </p>
  
  <pre><code>var set = new OptionSet {
      { "p=", "the project file", v =&gt; { /* do stuff */ } },
      { "s=", "a setting", (m, v) =&gt;  { /* do stuff */ } },
  };
  </code></pre>
  
  <p>and this works well in most cases, but when <code>value</code> is a file path (even quoted) the <code>\</code> causes the parser to drop everything to right. I've hacked round this by overriding the parse method on my own <code>OptionSet</code> class that I've inherited from <code>NDesk.Options.OptionSet</code>, but I was wondering if there are any libraries that can handle this kind of functionality out of the box?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Sorry it wasn't the <code>\</code> I think it is the <code>:</code> anyway a set of failing examples is:</p>
  
  <pre><code>-sSetting=C:\Temp
  -sSetting="C:\Temp"
  -s"Setting=C:\Temp"
  </code></pre>
  
  <p>They all fail with <code>OptionException  Error: Found 3 option values when expecting 2.</code></p>