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

Reply via email to