Ant script passing arguments to Batch file -
i have ant script need call batch script follows:
<exec dir="${basedir}\work_internal\${platform}" executable="cmd.exe"> <arg line ="/c example.bat 'c:\work_internal\${platform}' 'revn=120 special_objs='a b''" />
i need pass arguments example.bat, first argument directory , second argument 'revn=120 special_objs='a b'', special_objs='a b' 'a b' must in quotes. when calls bat script, discards quotes around 'a b' in second argument interpreted revn=120 special_objs= b.
how can make read revn=120 special_objs="a b"?
the single quotes don't pair how want them to, aught able embed single quotes using "
entity - like:
<arg line=" ... "revn=120 special_objs='a b'"" />
for me ant -verbose
above gives below:
[exec] executing 'cmd.exe' arguments: [exec] '/c' [exec] 'example.bat' [exec] 'c:\work_internal\${platform}' [exec] 'revn=120 special_objs='a z''
in posted xml quote pairs (v--v) here:
<arg line="/c example.bat v----------------------------v v----------------------v vv 'c:\work_internal\${platform}' 'revn=120 special_objs='a b''" />
which doesn't intend, , line broken incorrectly.
another way pass arguments batch script using separate arg value=
elements:
<exec dir="." executable="cmd.exe"> <arg value="/c" /> <arg value="example.bat" /> <arg value="c:\work_internal\${platform}" /> <arg value="revn=120 special_objs='a b'" /> </exec>
rather passing single line shell. sidesteps (shell) tokenization logic breaking line differently how wish.
Comments
Post a Comment