在执行嵌入式安装程序之前,如何等待父 NSIS 安装程序完成?
How to wait for parent NSIS Installer to be finished, before executing the embedded installer?
我正在尝试 运行 在另一个安装程序的脚本中安装一个安装程序。
父安装程序需要完成运行里面的嵌入式安装程序才能正确完成。
!include "MUI2.nsh"
Icon "C:\Users\user\Pictures\logo.ico"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section
ExecWait "$INSTDIR/CM/CMInstaller.exe"
SectionEnd
那么在执行 CMInstaller.exe 之前如何等待父安装程序?
感谢您的回答!
EDIT:
作为 pointed out, the -POST
is not a specific section name, just place this section (containing your child installer) after the main install section, or use .onInstSuccess回调函数
Original answer:
在我们的项目中,我们使用 -Post
部分来执行一些 post-installation 操作,例如将卸载程序或快捷方式放在桌面上,这可能不是最佳做法,因为指定的 -FinishComponents
部分情况,检查 here
Section -Post
SetShellVarContext all
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninst.exe"
CreateShortCut "$SMPROGRAMS$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\Uninst.exe"
;Write install path registry
WriteRegStr HKLM "${PRODUCT_INSTALL_DIR_REGKEY}" "${PRODUCT_INSTALL_DIR_SUBKEY}" $INSTDIR
!insertmacro WriteInstallLog "Install_log.log" "Installation completed"
;Execute CMInstaller here
ExecWait "$INSTDIR/CM/CMInstaller.exe"
SectionEnd
并且根据 NSIS 文档,安装成功后还有一个回调函数.onInstSuccess
我正在尝试 运行 在另一个安装程序的脚本中安装一个安装程序。 父安装程序需要完成运行里面的嵌入式安装程序才能正确完成。
!include "MUI2.nsh"
Icon "C:\Users\user\Pictures\logo.ico"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section
ExecWait "$INSTDIR/CM/CMInstaller.exe"
SectionEnd
那么在执行 CMInstaller.exe 之前如何等待父安装程序?
感谢您的回答!
EDIT:
作为-POST
is not a specific section name, just place this section (containing your child installer) after the main install section, or use .onInstSuccess回调函数
Original answer:
在我们的项目中,我们使用 -Post
部分来执行一些 post-installation 操作,例如将卸载程序或快捷方式放在桌面上,这可能不是最佳做法,因为指定的 -FinishComponents
部分情况,检查 here
Section -Post
SetShellVarContext all
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninst.exe"
CreateShortCut "$SMPROGRAMS$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\Uninst.exe"
;Write install path registry
WriteRegStr HKLM "${PRODUCT_INSTALL_DIR_REGKEY}" "${PRODUCT_INSTALL_DIR_SUBKEY}" $INSTDIR
!insertmacro WriteInstallLog "Install_log.log" "Installation completed"
;Execute CMInstaller here
ExecWait "$INSTDIR/CM/CMInstaller.exe"
SectionEnd
并且根据 NSIS 文档,安装成功后还有一个回调函数.onInstSuccess