【问题标题】:How to create two exe files with one nsis script?如何用一个 nsis 脚本创建两个 exe 文件?
【发布时间】:2012-10-22 12:44:56
【问题描述】:

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

例子:

传递参数为 $FULL_PKG =1(带 zip 文件),=0(不带 zip 文件) 名称“PKG” strcmp ${FULL_PKG} "1" 0 1 输出文件“FULLPKG.exe” 输出文件“PKG.exe”'

ERROR: command not valid outside section or function

【问题讨论】:

    标签: nsis


    【解决方案1】:

    Outfile 等属性不能在运行时更改(部分和函数中的代码)

    您可以使用 /D with makensis: makensis /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
    

    【讨论】:

      【解决方案2】:

      对我来说,这也是有效的(也许 2012 年还没有):

      !if ${FULL_PKG} == 1
          OutFile "FULLPKG.exe"
      !else
          OutFile "PKG.exe"
      !endif
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-01-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-08
        • 1970-01-01
        • 2018-09-24
        相关资源
        最近更新 更多