ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Westerman <>
Subject Issues With Quotes
Date Wed, 06 Nov 2013 01:06:15 GMT
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"
    <arg line="/c findstr /c:&quot;@{value}&quot; @{file}" />

>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 
\" - 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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message