title: How to pass CMD argument with spaces?
body: <p>I want to run simple <code>CMD</code> command and my <code>argument</code> contains spaces (" ").</p>
  
  <p>In this case this is not working since its recognized as command with several <code>arguments</code>...</p>
  
  <p>This is what I have tried (same results):</p>
  
  <pre><code>string arg = "c:\my path\ this is test\file.doc";
  
  string.Format("\"{0}\"", arg)
  </code></pre>
  
  <p>Edit:</p>
  
  <pre><code>public void Invoke(string fileName, string arg)
  {
      ProcessStartInfo processStartInfo = new ProcessStartInfo();
      processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
      processStartInfo.FileName = fileName;
      if (arg != "")
          processStartInfo.Arguments = arg;
      processStartInfo.RedirectStandardOutput = true;
      processStartInfo.RedirectStandardError = true;
      processStartInfo.RedirectStandardInput = true;
      processStartInfo.UseShellExecute = false;
      processStartInfo.CreateNoWindow = true;
  
      Process process = new Process();
      process.StartInfo = processStartInfo;
      process.Exited += Process_Exited;
      process.EnableRaisingEvents = true;
      process.Start();
      process.BeginOutputReadLine();
      process.BeginErrorReadLine();
  }
  </code></pre>
  
  <p>Usage:</p>
  
  <pre><code>string arg = "c:\my path\this is my string.ps1";   
  Invoke(@"C:\windows\system32\windowspowershell\v1.0\powershell.exe", string.Format("\"{0}\"", arg)); 
  </code></pre>