从GroovyConsole执行shell命令时出错

从GroovyConsole执行shell命令时出错,groovy,createprocess,groovy-console,Groovy,Createprocess,Groovy Console,我下载了适用于windows的apache-groovy-2.4.6,当我尝试执行“dir.execute()时,我得到了 java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified 你能告诉我出了什么问题吗?Windows没有“dir”作为可运行程序。它是一个位于cmd中的命令 试一试 println "cmd /c dir

我下载了适用于windows的apache-groovy-2.4.6,当我尝试执行“dir.execute()时,我得到了

java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified
你能告诉我出了什么问题吗?

Windows没有“dir”作为可运行程序。它是一个位于
cmd
中的命令

试一试

println  "cmd /c dir   c:\\".execute().text