加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – Ant exec – 无法运行程序’start’CreateProcess er

发布时间:2020-12-14 04:09:56 所属栏目:Windows 来源:网络整理
导读:我无法使用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/proje
我无法使用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”不适用于你的环境,为什么呢?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读