我无法使用ant exec运行
windows‘start’. Ant版本1.7.1.
以下是重新创建问题的示例build.xml
- <project name="test" basedir="." default="test-target">
- <target name="test-target">
- <exec executable="start">
- <arg line="cmd /c notepad" />
- </exec>
- </target>
- </project>
- Execute Failed: java.io.IOException: Cannot run program "start": Cre
- ateProcess error=2,The system cannot find the file specified
我的env是Windows XP,Ant 1.7.1
我试图从DOS提示符运行它.
我排除任何与PATH相关的问题,因为我可以手动从DOS promt运行’start cmd / c notepad’.
对于如何解决这个问题,有任何的建议吗?
干杯
一个
start不是可执行文件,而是cmd.exe shell的内部命令,所以要启动你必须执行的操作:
- <exec executable="cmd.exe">
- <arg line="/c start notepad" />
- </exec>
编辑:
为了产生多个窗口,这应该工作:
- <target name="spawnwindows">
- <exec executable="cmd.exe" spawn="yes">
- <arg line="/c start cmd.exe /k echo test1" />
- </exec>
- <exec executable="cmd.exe" spawn="yes">
- <arg line="/c start cmd.exe /k echo test2" />
- </exec>
- </target>
但你提到spawn =“true”不适用于你的环境,为什么呢?