title: Launch CMD command with spaces with JAVA
body: <p>I want to excute in CMD with ProcessBuilder and here's my code :</p>
  
  <pre><code>ProcessBuilder pb = new ProcessBuilder(
              "cmd /c start C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe --headless --disable-gpu --print-to-pdf javaGen.pdf  file:///C:/Users/User/Desktop/template/template2.html");
  pb.start();
  </code></pre>
  
  <p>But I keep getting : </p>
  
  <pre><code>Cannot run program "cmd /c start C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --headless --disable-gpu --print-to-pdf javaGen.pdf  file:///C:/Users/User/Desktop/template/template2.html": CreateProcess error=2, file not found
  </code></pre>
  
  <p>And I'm sure about chrome.exe and template2.html that they're in there respective paths.</p>
  
  <p><strong><em>EDIT</em></strong></p>
  
  <p>I also tried this : </p>
  
  <pre><code>Process p = Runtime.getRuntime().exec(
              "cmd /c start \"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --headless --disable-gpu --print-to-pdf javaGen.pdf  file:///C:/Users/User/Desktop/template/template2.html");
  </code></pre>
  
  <p>And I got : </p>
  
  <pre><code>windows can't find --headless
  </code></pre>
  
  <p><strong>*EDIT 2 *</strong></p>
  
  <p>I tried this command : </p>
  
  <pre><code>pb.command(new String[] { "cd \"Program Files (x86)\"", "cd Google\\Chrome\\Application\\",
              "chrome.exe --headless --disable-gpu --print-to-pdf javaGen.pdf  file:///C:/Users/User/Desktop/template/template2.html" });
      pb.start();
  </code></pre>
  
  <p>And I got : </p>
  
  <pre><code>Cannot run program "cd "Program Files (x86)"": CreateProcess error=2, File not found
  </code></pre>