【问题标题】:Error while executing shell commands from GroovyConsole从 GroovyConsole 执行 shell 命令时出错
【发布时间】:2023-03-06 21:12:01
【问题描述】:

当我尝试执行“dir”.execute() 时,我为 windows 和 GroovyConsole 下载了 apache-groovy-2.4.6,我得到了

java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified

你能说出哪里不对吗?

【问题讨论】:

    标签: groovy createprocess groovy-console


    【解决方案1】:

    Windows 没有“dir”作为可运行程序。这是cmd 中的built-in function

    试试

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

    【讨论】:

      猜你喜欢
      • 2011-06-15
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-21
      • 2014-01-22
      • 2011-03-04
      相关资源
      最近更新 更多