title: How to execute system commands in scala
body: <p>i am new at scala and i am trying to run this simple program that get input from the user and execute it in the operation system:</p>
  
  <pre><code>import scala.io._ 
  import sys.process._
  
  object MyCmd {
      def main(args: Array[String]) = {
        print("&gt; ")
        var inputString = StdIn.readLine()
  
        while(!inputString.trim().equals("exit")) {
          var proc = stringToProcess(inputString)
          println( proc.!!)
          print("&gt; ")
          inputString = StdIn.readLine()
       }
    }
  }
  </code></pre>
  
  <p>but when i'm running it:</p>
  
  <pre><code>c:\IDE\scala\test&gt;scala MyCmd
  &gt; dir
  java.io.IOException: Cannot run program "dir": CreateProcess error=2, The
  system cannot find the file specified
  ...
  </code></pre>
  
  <p>Any help will be much appreciate </p>