|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Setting Property to a path containing SpaceHi,
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 |
|
|
Re: Setting Property to a path containing SpaceOn Thu, Oct 22, 2009 at 13:27, Rohit P <rohitmp.for@...> wrote:
> 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: > Don't use <arg line="">, as it will split the line attribute with spaces. Use: <arg value="/c"/> <arg value="dir"/> <arg value="${SpaceVar}"/> -- Francis Galiegue ONE2TEAM Ingénieur système Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 fge@... 40 avenue Raymond Poincaré 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
AW: Setting Property to a path containing SpaceBetter 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:rohitmp.for@...] 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: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Setting Property to a path containing SpaceThanks a lot for your suggestions.
I tried to run as mentioned below and yep it worked for me. Thanks, once again. Have a nice day On Thu, Oct 22, 2009 at 5:15 PM, Knuplesch, Juergen < Juergen.Knuplesch@...> wrote: > 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:rohitmp.for@...] > 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: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > |
|
|
Re: Setting Property to a path containing SpaceOn Thu, Oct 22, 2009 at 13:45, Knuplesch, Juergen
<Juergen.Knuplesch@...> wrote: > 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. > No you don't. <arg value=""/> ensures that whatever the OS, the value is one and one argument only. No need to quote, since you use execve() (under Unix like) or the equivalent in Windows. -- Francis Galiegue ONE2TEAM Ingénieur système Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 fge@... 40 avenue Raymond Poincaré 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
AW: Setting Property to a path containing SpaceThanks, thats good to know...
Juergen -- Jürgen Knuplesch -----Ursprüngliche Nachricht----- Von: Francis GALIEGUE [mailto:fge@...] Gesendet: Donnerstag, 22. Oktober 2009 14:01 An: Ant Users List Betreff: Re: Setting Property to a path containing Space On Thu, Oct 22, 2009 at 13:45, Knuplesch, Juergen <Juergen.Knuplesch@...> wrote: > 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. > No you don't. <arg value=""/> ensures that whatever the OS, the value is one and one argument only. No need to quote, since you use execve() (under Unix like) or the equivalent in Windows. -- Francis Galiegue ONE2TEAM Ingénieur système Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 fge@... 40 avenue Raymond Poincaré 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |