title: Other way to put a path in quotes when using DirectoryInfo?
body: <p>I'm currently working with <code>reg.exe</code> and I'm creating a process with <code>reg.exe</code> as the <code>Process.FileName</code>.</p>
  
  <p>When I try to execute reg.exe like following</p>
  
  <pre><code>REG EXPORT HKLM\\SOFTWARE\\Intel\\IntelAMTUNS D:\\Backups\\Test.reg
  </code></pre>
  
  <p>everthing works fine.</p>
  
  <p>But as soon as I try to execute it like this</p>
  
  <pre><code>REG EXPORT HKLM\\SOFTWARE\\Intel\\IntelAMTUNS D:\\Backups\\Backup folder 1\\Test.reg 
  </code></pre>
  
  <p>nothing happens - and I know why! The target path isn't put in quotes. As soon as I do that everything works fine again. </p>
  
  <p>My problem now is that I'm handling all my file and folder paths as instances of <code>DirectoryInfo</code>. When I pass the path with quotes as a string, e.g. like that</p>
  
  <pre><code>DirectoryInfo targetFolder = new DirectoryInfo("\"D:\\Backups\\Backup folder 1\\Test.reg\"")
  </code></pre>
  
  <p>I instantly receive an exception telling me that <em>the given path's format is not supported</em>. </p>
  
  <p>Is there any way to put the path in quotes and still work with DirecotryInfo?
  I really need to put my path in quotes - otherwise the command won't work.</p>
  
  <p>Here's some example code:</p>
  
  <pre><code>DirectoryInfo backupPath = new DirectoryInfo("D:\\Backups\\Backup folder 1\\Test.reg");
  
  Process process = new Process();
  ProcessStartInfo startInfo = new ProcessStartInfo();
  
  startInfo.FileName = "reg.exe";
  startInfo.CreateNoWindow = true;
  startInfo.Arguments = "REG EXPORT HKLM\\SOFTWARE\\Intel\\IntelAMTUNS " + backupPath.FullName;
  
  process.StartInfo = startInfo;
  process.Start();
  process.WaitForExit();
  </code></pre>
  
  <p>When I run this code, nothing happens - nor errors or exceptions. The .reg file itself isn't created either.</p>
  
  <p>When I try to run it like this</p>
  
  <pre><code>DirectoryInfo backupPath = new DirectoryInfo("\"D:\\Backups\\Backup folder 1\\Test.reg\"");
  
  Process process = new Process();
  ProcessStartInfo startInfo = new ProcessStartInfo();
  
  startInfo.FileName = "reg.exe";
  startInfo.CreateNoWindow = true;
  startInfo.Arguments = "REG EXPORT HKLM\\SOFTWARE\\Intel\\IntelAMTUNS " + backupPath.FullName;
  
  process.StartInfo = startInfo;
  process.Start();
  process.WaitForExit();
  </code></pre>
  
  <p>I'm getting a <code>System.NotSupportedException</code> telling me "<em>The given path's format is not supported.</em>" But I actually need to put the path in quotes - otherwise the command itself won't work...</p>