You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Ron J. Green, Jr." <rg...@austin.rr.com> on 2000/11/14 01:21:27 UTC

Help with exec

Hello,

I just started using ANT this week and am rapidly growing to rely upon it.
However, I'm having trouble with the "exec" task. On my Windows 2000 machine
when I add the os="windows" attribute, it fails to execute. But when I echo
the "os" property it prints "windows". Example below.

  <target name="test">
    <echo message="${os}" />
    <exec executable="dir" os="windows"/>
  </target>

Thanks in advance for any assistance.

Ron


Re: Help with exec

Posted by Stefan Bodewig <bo...@bost.de>.
Ron J. Green, Jr. <rg...@austin.rr.com> wrote:

> You're right, I picked a bad example. Your example works fine as
> long as I leave out os="windows". If I include it, however, doesn't
> run on my Windows 2000 machine.
> 
> Is this a known problem. I checked the FAQ and didn't see it
> mentioned.

Does it work if you use a capital W in Windows (don't have Windows
here to check). Looking at the code it seems to be case sensitive.

Stefan

RE: Help with exec

Posted by "Ron J. Green, Jr." <rg...@austin.rr.com>.
You're right, I picked a bad example. Your example works fine as long as I
leave out os="windows". If I include it, however, doesn't run on my Windows
2000 machine.

Is this a known problem. I checked the FAQ and didn't see it mentioned.

Thanks again,
Ron

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@bost.de]
Sent: Tuesday, November 14, 2000 2:14 AM
To: ant-user@jakarta.apache.org
Subject: Re: Help with exec


Ron J. Green, Jr. <rg...@austin.rr.com> wrote:

> However, I'm having trouble with the "exec" task. On my Windows 2000
> machine when I add the os="windows" attribute, it fails to
> execute. But when I echo the "os" property it prints
> "windows". Example below.
>
>   <target name="test">
>     <echo message="${os}" />
>     <exec executable="dir" os="windows"/>
>   </target>
>

I may be wrong (as I don't have the slightest understanding of Windows
8-), but ISTR dir is not an executable but a shell builtin.

Does

<exec executable="cmd" os="windows">
  <arg line="/c dir" />
</exec>

or something similar work?

Stefan


Re: Help with exec

Posted by Stefan Bodewig <bo...@bost.de>.
Ron J. Green, Jr. <rg...@austin.rr.com> wrote:

> However, I'm having trouble with the "exec" task. On my Windows 2000
> machine when I add the os="windows" attribute, it fails to
> execute. But when I echo the "os" property it prints
> "windows". Example below.
> 
>   <target name="test">
>     <echo message="${os}" />
>     <exec executable="dir" os="windows"/>
>   </target>
> 

I may be wrong (as I don't have the slightest understanding of Windows
8-), but ISTR dir is not an executable but a shell builtin.

Does

<exec executable="cmd" os="windows">
  <arg line="/c dir" />
</exec>

or something similar work?

Stefan