ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Darragh" <>
Subject Apply argument wrapping with msiexec
Date Tue, 09 Nov 2010 14:53:05 GMT

I have the following target in a project

  <target name="extract-msi" depends="init" if="" >
    <mkdir dir="${build.dir}/extract/msi" />
    <apply executable="msiexec" failonerror="true" >
      <arg value="/a" /> <!-- administrative install -->
      <arg value='TARGETDIR="${build.dir}\extract\msi"' />
      <fileset dir="${src.dir}" >
        <include name="**/*.msi" />

Basically the problem appears to be with the TARGETDIR line. If I remove that line, then the
msiexec command will run just fine, but will extract the msi contents to the wrong location
(C:\). It seems that despite the claims in the console:
The ' characters around the executable and arguments are
not part of the command.

It seems that the command is in fact executed with them wrapped around it, since running the
following at the command prompt will fail (subsituted in some values):
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' 'TARGETDIR="C:\Documents and

While this works:
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' TARGETDIR="C:\Documents and

I've got the following to work, but it's only useful as long as there is only 1 msi to be
  <target name="extract-msi" depends="init" if="" >
    <mkdir dir="${build.dir}/extract/msi" />
    <fileset dir="${src.dir}" id="files.msi" >
      <include name="**/*.msi" />
    <exec executable="cmd" failonerror="true" >
      <arg value="/c" />
      <arg value='msiexec /a "${src.dir}\${toString:files.msi}" /qn TARGETDIR="${build.dir}\extract\msi"
/l*v "${build.dir}\msi.log"' />

Any suggestions on how to utilise the apply task to have this work for when dealing with multiple
msi's as opposed to only being able to handle one?

I've tried experimenting with the line, file, value versions of the arg element, all produce
the same result.

Darragh Bailey

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message