title: Escape space in ProcessBuilder
body: <p>I am not able to execute the following code in Eclipse:</p>
  
  <pre><code>public static void main(String[] arg){
      String path="C:\\Users\\my dir\\SendMailPS.ps1";
      ProcessBuilder processBuilderObject
                  = new ProcessBuilder("powershell",path);
      try {
          processBuilderObject.start();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>But I am able to execute it if path is as <code>C:\\Users\\SendMailPS.ps1</code>. So the problem is with spaces, how can I solve this?</p>
  
  <p><strong>Edit:</strong> I tried like this as well</p>
  
  <pre><code>public static void main(String[] arg){
      String path="C:\\Users\\my dir\\SendMailPS.ps1";
      try {
          Runtime.getRuntime().exec("powershell "+path);
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>But no use. Then I tried directly from command prompt</p>
  
  <pre><code>&gt;powershell
  &gt; C:\Users\SendMailPS.ps1
  </code></pre>
  
  <p>This gives me output. But following line gives me error </p>
  
  <pre><code>&gt;powershell
  &gt; C:\Users\my dir\SendMailPS.ps1
  </code></pre>
  
  <p>error:</p>
  
  <blockquote>
    <p>C:\Users\my : The term 'C:\Users\my' is not recognized as the
    name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is
    correct and try again.</p>
  </blockquote>