蚂蚁EXEC - 不能运行程序'开始'CreateProcess的错误= 2 [英] Ant exec - cannot run program 'start' CreateProcess error=2

查看:534
本文介绍了蚂蚁EXEC - 不能运行程序'开始'CreateProcess的错误= 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能运行Windows的开始蚁使用EXEC。蚂蚁版本1.7.1。

I can't run the windows 'start' using ant exec. Ant version 1.7.1.

下面是示例build.xml来重现问题

Here is sample build.xml to recreate the problem

<project name="test"  basedir="." default="test-target">
<target name="test-target">
        <exec executable="start">
            <arg line="cmd /c notepad" />  
        </exec>      
</target>
</project>

得到以下错误,当我执行此构建文件:

getting the following error when I execute this build file:

Execute failed: java.io.IOException: Cannot run program "start": Cre
ateProcess error=2, The system cannot find the file specified

我的env是Windows XP中,蚂蚁1.7.1
我试图从DOS提示符下运行这一点。
我排除任何路径相关的问题,因为我可以运行CMD启动/ C记事本从DOS手动PROMT。

My env is Windows XP, Ant 1.7.1 I am trying to run this from DOS prompt. I rule out any PATH related issues, as I could run 'start cmd /c notepad' from DOS promt manually.

这是如何解决这一问题有什么建议?

Any suggestions on how to fix this?

欢呼
A S

cheers a s

推荐答案

开始不是可执行反而是cmd.exe的外壳的内部命令,所以开始的东西你必须:

start is not an executable but is an internal command of the cmd.exe shell, so to start something you'd have to:

<exec executable="cmd.exe">
        <arg line="/c start notepad" />  
    </exec>

编辑:

有关产卵多个窗口,这应该工作:

For spawning multiple windows, this should work:

<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>

但你提到产卵=true是不适用于你的环境,这是为什么?

but you mentioned that spawn="true" is not applicable for your environment, why is that?

这篇关于蚂蚁EXEC - 不能运行程序'开始'CreateProcess的错误= 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆