NSIS脚本:在安装过程中将exe嵌入其他exe并解压缩

时间:2013-12-20 09:31:17

标签: extract exe nsis

!include "MUI2.nsh"
!include "WordFunc.nsh"
 # define the name of the installer
outfile "simple installer.exe"


!macro installVddk

MessageBox MB_OKCANCEL "a.exe is required for installing agent.Do you wish to install it?" IDOK lblinst IDCANCEL abort_inst

abort_inst:
          ABORT
          GoTo lblinst


lblinst:
SetOutPath $EXEDir
;MessageBox MB_OK $OUTDIR
File a.exe
ExecWait "a.exe" $1
!macroend

# default section
section " Agent (required)" main_section
sectionEnd

Function .onInit
    !insertmacro installVddk 
FunctionEnd

我的问题是:

1.我必须在编译期间将a.exe保存在与NSI脚本相同的目录中。 如果它是NSI脚本以外的目录,我如何以及在何处指定可以从中获取a.exe的位置?

2.如果File a.exe命令正在解压缩exe,那么代码捆绑了exe,在编译期间。请帮助

1 个答案:

答案 0 :(得分:1)

编译时,

a.exe 不必与 .nsi 脚本位于同一文件夹中,但您必须在“文件”中声明完整路径 - 考虑以下事项:

    SetOutPath $EXEDir
    File "C:\A_folder\a.exe"
    ExecWait "$EXEDir\a.exe"
  1. 使用SetOutPath,告诉您在运行安装程序时将文件部署到何处
  2. 然后使用File告诉NSIS要包装的文件(将在部署期间使用)
相关问题