title: c# use quotes in App.config to run batch
body: <p>I have an issue with using double quotes. From my application I need to execute a 3rd party batchfile. This bacthfile takes parameters that include double quotes.
  The bacthfile:</p>
  
  <pre><code>\\\\myserver\data\program\mainprog.exe -username"martin" -password"abc123"
  </code></pre>
  
  <p>I have added the location of this file to my App.config. I can''t put the quotes in there, nor can I use escapes, so I used # insead:</p>
  
  <pre><code>[ add key="mBatch" value="\\myserver\data\program\mainprog.exe -username#martin# -password#abc123#" /]
  </code></pre>
  
  <p>After reading this key I replace the # as followed:</p>
  
  <pre><code>_settings = new AppSettings();
  _settings.batch = System.Configuration.ConfigurationManager.AppSettings.Get("mBatch").ToString();
  _settings.batch = _settings.batch.Replace(@"\", "\\");
  _settings.batch = _settings.batch.Replace("#", "\"");
  </code></pre>
  
  <p>When I print _settings.batch it looks perfect.</p>
  
  <p>Next I try to run the batch:</p>
  
  <pre><code>System.Diagnostics.Process proc = new System.Diagnostics.Process();
  proc.StartInfo.FileName = _settings.batch; 
  proc.StartInfo.UseShellExecute = true;
  proc.Start();
  </code></pre>
  
  <p>This results in an error indicating that the path cannot be found.
  If I put the contents of _settings.batch in a text field, copy-paste it and run it, it works, so the path and parameters are correct.</p>
  
  <p>Does anyone have a solution?
  Thanks.</p>