2014-02-20 49 views
1

由于每documentation它说运行date命令(“无法运行程序...系统找不到指定的文件”)

OsCommands - 此命令的关键字是感叹号,后感叹号 点可以在Unix /窗口命令字符串传递给被执行

这意味着,我们可以通过用!(感叹号)前缀的OS命令执行在弹簧壳OS命令。

但我相信有一些问题或我错过了一些东西。当我尝试时,我得到了下面的错误。

hw-shell>! date 
command is: date 
Unable to execute command date [Cannot run program "date" (in directory "."): CreateProcess error=2, The system cannot find the file specified] 

回答

0

我认为你可能忘了设置类路径在春天壳类,使用下面的线,然后尝试设置类路径...

new ClassPathXmlApplicationContext("classpath*:/META-INF/spring/spring-shell-plugin.xml");

对于更多参考:http://docs.spring.io/spring-shell/docs/current/reference/html/shell.html

+0

Jorg,谢谢你的回复。我运行了通常随分发而来的示例程序。 Spring ApplicationContext已经配置好了。仅当我在Windows中启动Spring Shell时才会执行OS命令。在Linux中,它工作正常。 – user3332626

0

您是否确实在窗口中的%PATH%环境中具有“date”命令,根据其缺失的异常消息。

0

“date”是windows命令shell的内置命令。看起来,这些内置命令在spring-shell中不可用,并且spring-shell会在windows路径中以文件形式存在的命令之后进行查看。

可用的Windows命令,如calc(! calc),这些命令不是内置的。

相关问题