Better use only arg  without line. Then you give each argument alone. The 
syntax is:
<arg value="/c" />
<arg value="dir" />
<arg value="${SpaceVar}" />

But probably you need quotes, because this is read bei windows batch stuff.

By the way: I hate spaces in pathnames....


-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Rohit P [mailto:[email protected]] 
Gesendet: Donnerstag, 22. Oktober 2009 13:27
An: Ant Users List
Betreff: Setting Property to a path containing Space

Hi,

I have a requirement to execute a program that uses a path as an argument.
The path argument is set using <property> task.

    <property name="SpaceVar" value="C:/Program Files"/>

    <target name="EchoVar">
           <echo> SpaceVar = ${SpaceVar} </echo>
           <exec dir="${basedir}" executable="cmd.exe" failonerror="true">
               <arg line="/c dir ${SpaceVar}"/>
           </exec>

    </target>

After execution of the above snippet i am getting the below error:

E:\Scripts>ant -f SpaceVar.xml
Buildfile: SpaceVar.xml

EchoVar:
     [echo]  SpaceVar = C:/Program Files
     [exec] Parameter format not correct - "Program".

BUILD FAILED
E:\Scripts\SpaceVar.xml:7: exec returned: 1

I am not sure of exactly setting the property SpaceVar to include double quotes.
Can anybody help me achieve successful execution for the above snippet?

Thanks for your effort.

Thanks
Rohit

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to