0

I'm trying to use msiexec to install a package. I'm giving the command from a batch file in Windows Vista. The given MSI filename has many spaces. Some of the postings on the web say that msi filenames should not have spaces. But this package and its related add-ons, all have their MSI filenames with spaces. What should I do? I tried this with multiple variations on quotes, none of them worked. :(

msiexec /i "%~dp0\PackageDirectory\"Package File Name.msi""

The PackageDirectory is within the directory from which I run the batch script.

Kamalakshi
  • 6,918
  • 3
  • 17
  • 21
  • 4
    I can't tell about MSIEXEC, but in your example above there are definitely too many quotes. `"%~dp0\PackageDirectory\Package File Name.msi"`should do. – Stephan Dec 01 '13 at 14:35
  • Thanks a lot! It worked! I thought I had tried that earlier, may be something else was wrong at that time. Anyway, thanks again, it was driving me crazy for a while. – Kamalakshi Dec 01 '13 at 16:07

1 Answers1

1

As suggested in the comment you needed to surround only the full path with double quotes like this:

msiexec /i "%~dp0\PackageDirectory\Package File Name.msi"

This can get more complicated for properties which may require additional back-ticks to escape each double-quote like this:

msiexec /i "%~dp0\PackageDirectory\Package File Name.msi" INSTALLDIR=`"[Destination Path With Spaces]`"

For more information on the second issue: Command line arguments for msiexec break on powershell if they contain space