Running MSIEXEC in a NSIS script with installer switches

时光总嘲笑我的痴心妄想 提交于 2019-12-25 00:09:11

问题


I'm trying to build an NSIS installer and package it with necessary drivers (MSI files from the vendor). Eventually, I'd like to install these drivers silently in the backgroud. However, I cannot seem to get it working properly.

In my NSIS script, I have the following:

ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR="$INSTDIR\Drivers\Flash""'

It seems to execute; if I remove the INSTALLDIR switch from the above snippet, it'll run the driver installation as expected. But when I leave it in, I'm instead greeted by the following window

However, running the following directly in Powershell does exactly what I want, sets the install directory appropriately, as expected:

.\Flash.msi INSTALLDIR=".\Drivers\Flash\"

I'm guessing it's a silly quotation-mark mismatch somewhere, but I've tried so many already and I get the same results.


回答1:


Your doublequote for the .msi path is closed too late.

Use

ExecWait 'msiexec /i "$INSTDIR\Flash.msi" INSTALLDIR="$INSTDIR\Drivers\Flash"'



回答2:


Have you tried the following:

ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR=$\"$INSTDIR\Drivers\Flash$\""'

or

ExecWait 'msiexec /i "$INSTDIR\Flash.msi INSTALLDIR=$\"$\"$INSTDIR\Drivers\Flash$\"$\""'

Reference: http://nsis.sourceforge.net/Docs/Chapter4.html and take a look at the Strings section under 4.1 Script File Format.

Updated with extra escaped quotes.



来源:https://stackoverflow.com/questions/51445588/running-msiexec-in-a-nsis-script-with-installer-switches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!