使用NSIS嵌入其他安装程序

时间:2013-09-30 18:04:10

标签: nsis

我是NSIS脚本的新手。我想创建一个自定义安装程序,它将包装另一个安装程序(FEKO)。在NSIS网站上建议的这种方法Embedding other installers对我不起作用

脚本编译正确但未安装嵌入式应用程序。这是脚本

!include "MUI2.nsh"
!include "logiclib.nsh"

!insertmacro MUI_PAGE_WELCOME 
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"


#Name of the application we are trying to install
Name "FEKO"

# update this section to add 'contact' info
BrandingText "Please contact support at xyz@abc.com for any issues.   "


# define the name of installer
OutFile "Custom_FEKO_6.2_Installer.exe"

# define default installation directory
InstallDir "C:\FEKO\6.2\"

DirText "Choose a directory where you want to install FEKO"


# start default section
Section "FEKO Installation"

    # set the installation directory as the destination for the following actions
    SetOutPath $INSTDIR

    DetailPrint "Extracting FEKO Files into Installation Directory" 

    # specify files to go into the installation directory path
    File /r "C:\Feko_Installer\*"

    # set the current working directory
    SetOutPath "$INSTDIR"      
SectionEnd


Section "FEKO installation" FEKO
    DetailPrint "Installing Feko"

    # run the FEKO installer and wait for it to finish

    File "C:\Feko_Installer\feko_distrib_6.2_win64.exe"
    ExecWait "$INSTDIR\feko_distrib_6.2_win64.exe"

    DetailPrint "Finishing up Installation"
SectionEnd

1 个答案:

答案 0 :(得分:2)

  1. 如果子安装程序需要管理员权限,则需要在脚本中放置RequestExecutionLevel admin。如果exe具有请求提升的清单,则ExecWait(CreateProcess)将失败。
  2. ExecWait的正确引用是:ExecWait '"c:\full\path\to\app.exe" /param1 "par am 2" /param3'