Discussion:
Spaces in a command line arg
David Clements
2003-02-22 00:52:24 UTC
Permalink
Is there a way to get ant to escape possible space in an <arg> to and <exec> call?


Occasionally there is a space in a file path and it breaks if it is not escaped or quoted.

Dave
Conor MacNeill
2003-02-22 08:12:10 UTC
Permalink
Post by David Clements
Is there a way to get ant to escape possible space in an <arg> to and <exec> call?
If you use the <arg value=""> approach with an entry per argument, rather
than all arguments in the <arg line=""> style, it should quote arguments
with spaces. If this doesn't work for you, please give us more detils on how
it fails.

Conor
David Clements
2003-02-25 21:35:09 UTC
Permalink
I am using the exec task to launch InstallShiels Multiplatform. The path in question
${productImportDirectory} has a space in it. Neither single or double quotes worked. However if I use a
combinatio of both single and double quotes things are working great.

TASK:
<exec executable="${ISMPDirectory}\ismpc.exe" dir="${ISMPDirectory}" >
<arg line='"${ISMPFile}"'/>
<arg line ='-alias IS_PRD=${productImportDirectory}'/>
<arg line ='-alias IS_INSTALLFILES="C:\vgdev\testing
tmp\current\NEWINSTALL\installer\defaultInstallFiles"'/>
<arg line="-xsl"/>
<arg line='"${basedir}\..\ismp\omitInactiveComponents.xsl"'/>
<arg line="-build"/>
</exec>

ERROR:
[exec] Initializing InstallShield MultiPlatform 4.5...
[exec] Searching for Java(tm) Virtual Machine...
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] .
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] ........Setting alias IS_PRD to C:\vgdev\testing
[exec] illegal command line argument : tmp\current\NEWINSTALL\SiteScope\19\


[exec] Running InstallShield MultiPlatform 4.5...

[exec] Result: -3

Hope this helps,

Dave
-----Original Message-----
Sent: Saturday, February 22, 2003 1:12 AM
To: Ant Users List
Subject: Re: Spaces in a command line arg
Post by David Clements
Is there a way to get ant to escape possible space in an
<arg> to and
Post by David Clements
<exec> call?
If you use the <arg value=""> approach with an entry per
argument, rather
than all arguments in the <arg line=""> style, it should
quote arguments
with spaces. If this doesn't work for you, please give us
more detils on how
it fails.
Conor
---------------------------------------------------------------------
Dominique Devienne
2003-02-25 21:51:29 UTC
Permalink
Just use value="" instead of line="", as Conor advised. This is the Ant
way... (whatever that means). --DD

-----Original Message-----
From: David Clements [mailto:***@merc-int.com]
Sent: Tuesday, February 25, 2003 3:35 PM
To: 'Ant Users List'
Subject: RE: Spaces in a command line arg

I am using the exec task to launch InstallShiels Multiplatform. The path in
question
${productImportDirectory} has a space in it. Neither single or double
quotes worked. However if I use a
combinatio of both single and double quotes things are working great.

TASK:
<exec executable="${ISMPDirectory}\ismpc.exe" dir="${ISMPDirectory}" >
<arg line='"${ISMPFile}"'/>
<arg line ='-alias IS_PRD=${productImportDirectory}'/>
<arg line ='-alias IS_INSTALLFILES="C:\vgdev\testing
tmp\current\NEWINSTALL\installer\defaultInstallFiles"'/>
<arg line="-xsl"/>
<arg line='"${basedir}\..\ismp\omitInactiveComponents.xsl"'/>
<arg line="-build"/>
</exec>

ERROR:
[exec] Initializing InstallShield MultiPlatform 4.5...
[exec] Searching for Java(tm) Virtual Machine...
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] .
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] ........Setting alias IS_PRD to C:\vgdev\testing
[exec] illegal command line argument : tmp\current\NEWINSTALL\SiteScope\19\


[exec] Running InstallShield MultiPlatform 4.5...

[exec] Result: -3

Hope this helps,

Dave
-----Original Message-----
Sent: Saturday, February 22, 2003 1:12 AM
To: Ant Users List
Subject: Re: Spaces in a command line arg
Post by David Clements
Is there a way to get ant to escape possible space in an
<arg> to and
Post by David Clements
<exec> call?
If you use the <arg value=""> approach with an entry per
argument, rather
than all arguments in the <arg line=""> style, it should
quote arguments
with spaces. If this doesn't work for you, please give us
more detils on how
it fails.
Conor
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org
David Clements
2003-02-25 22:00:54 UTC
Permalink
I see, thanks for the tip.

Dave
-----Original Message-----
Sent: Tuesday, February 25, 2003 2:51 PM
To: 'Ant Users List'
Subject: RE: Spaces in a command line arg
Just use value="" instead of line="", as Conor advised. This
is the Ant way... (whatever that means). --DD
-----Original Message-----
Sent: Tuesday, February 25, 2003 3:35 PM
To: 'Ant Users List'
Subject: RE: Spaces in a command line arg
I am using the exec task to launch InstallShiels
Multiplatform. The path in question
${productImportDirectory} has a space in it. Neither single
or double quotes worked. However if I use a combinatio of
both single and double quotes things are working great.
<exec executable="${ISMPDirectory}\ismpc.exe" dir="${ISMPDirectory}" >
<arg line='"${ISMPFile}"'/>
<arg line ='-alias IS_PRD=${productImportDirectory}'/>
<arg line ='-alias
IS_INSTALLFILES="C:\vgdev\testing
tmp\current\NEWINSTALL\installer\defaultInstallFiles"'/>
<arg line="-xsl"/>
<arg
line='"${basedir}\..\ismp\omitInactiveComponents.xsl"'/>
<arg line="-build"/>
</exec>
[exec] Initializing InstallShield MultiPlatform 4.5...
[exec] Searching for Java(tm) Virtual Machine...
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] .
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] ........Setting alias IS_PRD to C:\vgdev\testing
tmp\current\NEWINSTALL\SiteScope\19\
[exec] Running InstallShield MultiPlatform 4.5...
[exec] Result: -3
Hope this helps,
Dave
-----Original Message-----
Sent: Saturday, February 22, 2003 1:12 AM
To: Ant Users List
Subject: Re: Spaces in a command line arg
Post by David Clements
Is there a way to get ant to escape possible space in an
<arg> to and
Post by David Clements
<exec> call?
If you use the <arg value=""> approach with an entry per
argument, rather
than all arguments in the <arg line=""> style, it should
quote arguments
with spaces. If this doesn't work for you, please give us
more detils on how
it fails.
Conor
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Jim Allers
2003-02-25 22:17:50 UTC
Permalink
I have a custom task which invokes InstallShield Multiplatform 4.53
builds. It does what has been suggested before which is use <arg
value="" /> instead of <arg line="" />. I hope you find it helpful.

Example usage:
<installshield installscript="install/product.xml"
buildconfiguration="0"
installshielddir="C:\Program Files\InstallShield\MP45">
<!-- optional classpath, appends this classpath to the
expected installshield classpath -->
<classpath refid="custombeans.path" />
<!-- optional alias -->
<alias name="ALIAS_1" dir="install" />
</installshield>

The 'installshield' task can also have attributes 'xsl' (XSL file),
'save' (whether or not to save the modification in the project), and
'saveas' (file to save the modified script to).

-----Original Message-----
From: David Clements [mailto:***@merc-int.com]
Sent: Tuesday, February 25, 2003 3:35 PM
To: 'Ant Users List'
Subject: RE: Spaces in a command line arg


I am using the exec task to launch InstallShiels Multiplatform. The
path in question ${productImportDirectory} has a space in it. Neither
single or double quotes worked. However if I use a combinatio of both
single and double quotes things are working great.

TASK:
<exec executable="${ISMPDirectory}\ismpc.exe" dir="${ISMPDirectory}" >
<arg line='"${ISMPFile}"'/>
<arg line ='-alias IS_PRD=${productImportDirectory}'/>
<arg line ='-alias IS_INSTALLFILES="C:\vgdev\testing
tmp\current\NEWINSTALL\installer\defaultInstallFiles"'/>
<arg line="-xsl"/>
<arg
line='"${basedir}\..\ismp\omitInactiveComponents.xsl"'/>
<arg line="-build"/>
</exec>

ERROR:
[exec] Initializing InstallShield MultiPlatform 4.5...
[exec] Searching for Java(tm) Virtual Machine...
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] .
[exec] Verifying Jview 1.1.4 by Microsoft
[exec] ........Setting alias IS_PRD to C:\vgdev\testing
[exec] illegal command line argument :
tmp\current\NEWINSTALL\SiteScope\19\


[exec] Running InstallShield MultiPlatform 4.5...

[exec] Result: -3

Hope this helps,

Dave
-----Original Message-----
Sent: Saturday, February 22, 2003 1:12 AM
To: Ant Users List
Subject: Re: Spaces in a command line arg
Post by David Clements
Is there a way to get ant to escape possible space in an
<arg> to and
Post by David Clements
<exec> call?
If you use the <arg value=""> approach with an entry per
argument, rather
than all arguments in the <arg line=""> style, it should
quote arguments
with spaces. If this doesn't work for you, please give us
more detils on how
it fails.
Conor
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org

Loading...