如何使用一个nsis脚本创建两个exe文件?

问题描述 投票:1回答:2

我必须使用一个nsis脚本创建两个exe文件。一个包含zip文件作为完整包,另一个不包含zip文件。我在perl文件中设置一个参数,该文件调用我的nsis脚本并使用nsis脚本中的参数。问题在于“outfile”。无法检查条件。

例:

传递参数为$ FULL_PKG = 1(带有zip文件),= 0(没有zip文件)名称“PKG”Strcmp $ {FULL_PKG}“1”0 1 outfile“FULLPKG.exe”outfile“PKG.exe”'

ERROR: command not valid outside section or function
nsis
2个回答
0
投票

Outfile这样的属性在运行时无法更改(代码和节中的代码)

您可以使用/D with makensismakensis /DNOZIP yourscript.nsi创建定义,然后检查此定义:

!ifdef NOZIP
Outfile nozip.exe
!else
Outfile withzip.exe
!endif
...
Section
!ifndef NOZIP
File foo.zip ;Extract the zip file
!endif
SectionEnd

0
投票

对我来说,这也有效(可能在2012年没有):

!if ${FULL_PKG} == 1
    OutFile "FULLPKG.exe"
!else
    OutFile "PKG.exe"
!endif
© www.soinside.com 2019 - 2024. All rights reserved.