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-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to