Ant exec - 无法运行程序“start”创建进程错误=2
我无法使用 ant exec 运行 Windows“启动”。蚂蚁版本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
我的环境是 Windows XP,Ant 1.7.1 我正在尝试从 DOS 提示符运行它。 我排除了任何与 PATH 相关的问题,因为我可以从 DOS promt 手动运行“start cmd /c notepad”。
关于如何解决这个问题有什么建议吗?
干杯 作为
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
start 不是可执行文件,而是 cmd.exe shell 的内部命令,因此要启动您必须执行的操作:
编辑:
对于生成多个窗口,这应该有效:
但您提到spawn =“true”不适用对于您的环境,这是为什么?
start is not an executable but is an internal command of the cmd.exe shell, so to start something you'd have to:
EDIT:
For spawning multiple windows, this should work:
but you mentioned that spawn="true" is not applicable for your environment, why is that?
我的解决方案
my solution
怎么样?或者start.bat?另外,
basedir="."
指向哪里?如果您在
标记之前放置
,它是否会打印正确的文件夹(里面有“启动”程序的那个)?此外,您可以在
之前添加
以查看所有可见属性。How about
<exec executable="start.exe">
? Or start.bat ?Also, where is
basedir="."
pointing to? If you place a<echo message="basedir = ${basedir}"/>
just before your<exec>
tag, does it print the correct folder (the one with the "start" program in it)?Additionally, you could add
<echoproperties />
before<exec>
to see all visible properties.