这是一个非常基本的问题,但我似乎找不到我做错了什么。
因此,我在曲解NSIS中的定义,它并没有像我预期的那样起作用,所以我已经将问题缩小到最小的部分,而且我仍然无法使它像我所期望的那样工作。
脚本如下:
!ifndef b
!define b ""
!endif
!if $b=="b"
!define a "b"
!else
!define a "c"
!endif
Section
MessageBox MB_OK "a: ${a} b: ${b}"
SectionEnd我使用标志/Db=b运行它。
产出仍然是:
a: "c" b: "b"我错过了一些琐碎的东西!
发布于 2015-01-23 12:41:50
B是一个定义,而不是一个变量:
!ifndef b
!define b ""
!endif
!if "${b}" == "b" # <-- Modify this line.
!define a "b"
!else
!define a "c"
!endif
Section
MessageBox MB_OK "a: ${a} b: ${b}"
SectionEnd此外,我建议您在使用if时引用所有内容,因为如果定义(或变量值)为空,则会出现错误。
https://stackoverflow.com/questions/28109626
复制相似问题