title: How to run the following Powershell command in java?
body: <p>I am trying to run a powershell command which starts the tomcat service.Currently the command is working perfectly when executed directly through the windows powershell. However if i run the same command from java i get and error saying </p>
  
  <blockquote>
    <p>Start-Process : A positional parameter cannot be found that accepts argument 'net'.</p>
  </blockquote>
  
  <p>my powershell command is:</p>
  
  <pre><code>Start-Process -verb runas cmd -ArgumentList "/k net start Tomcat7"
  </code></pre>
  
  <p>my java code:</p>
  
  <pre><code>final String PS_COMMAND = " powershell.exe  Start-Process -verb runas cmd -ArgumentList /k net start Tomcat7   " ;
  Process p=  Runtime.getRuntime().exec(PS_COMMAND);
   BufferedReader BR=new BufferedReader(new InputStreamReader(p.getInputStream()));
               String l;
               while((l=BR.readLine()) != null){
                   System.out.print(l);
               }
  </code></pre>