I have a problem with double-quotes in Ant, and I'm not sure how to get 
around the problem.

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>

>From the command line, the findstr command can handle a quote in the data; 
for instance, this works to find a quote in the file:

> findstr /c:"""

However, Ant chokes when it encounters any quotes in the data I am passing 
to the macro via the '@{value}' argument. I have tried the following in 
the '@{value}' argument:
" - unbalanced quote error
"" - no syntax error, but doesn't work, because it's looking for two 
quotes
\" - unbalanced quote error
\\" - unbalanced quote error

Any ideas how I can handle quotes in the '@{value}' argument? I will never 
know beforehand what may be in it.

Thanks!

Reply via email to