ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Earl Hood <e...@earlhood.com>
Subject Re: Issues With Quotes
Date Wed, 06 Nov 2013 01:23:11 GMT
On 11/5/13, Dave Westerman wrote:

> I'm passing in an attribute that contains a value to search for in a file
> in Windows. I'm doing this:
>
> <exec executable="cmd.exe"
>         resultproperty="retcode"
>         outputproperty="output">
>     <arg line="/c findstr /c:&quot;@{value}&quot; @{file}" />
> </exec>

I normally avoid using <arg line> since some additional parsing is done
by Ant (or the sub-shell), and it may mess things up.  Break up the
arguments like the following to see if things work:

  <exec executable="cmd.exe"
          resultproperty="retcode"
          outputproperty="output">
      <arg value="/c" />
      <arg value="findstr" />
      <arg value='/c:"@{value}"' />
      <arg value="@{file}" />
  </exec>

Note, not sure if the double-quotes are still required around @{value}
or not, you will have to test things out.  Windows batch (cmd.exe)
syntax is ugly, especially when dealing with quotes.

--ewh

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message