nsis中的复合字符串比较

时间:2015-12-02 20:56:36

标签: nsis

如何在NSIS中进行复合字符串比较?

基本上类似于:if ( str1 == "" || str2 == "" ) ...

strcpy $1 "c:\foo"
strcpy $2 "d:\bar"

${if} strcmp $1 ""
${orif} strcmp $2 ""
   MessageBox MB_OK "one or both are empty"
${else}
   messagebox mb_ok "both are not"
${endif}
SectionEnd

1 个答案:

答案 0 :(得分:2)

StrCmp是NSIS字符串比较核心的低级指令,但在使用LogicLib时,您必须使用正确的运算符:==!=S==S!=(所有这些都列在LogicLib.nsh的顶部,不区分大小写的运算符在内部使用StrCmp

!include LogicLib.nsh
Section
StrCpy $1 "c:\foo"
StrCpy $2 "d:\bar"

${If} $1 == ""
${OrIf} $2 == ""
   MessageBox MB_OK "one or both are empty"
${Else}
   MessageBox MB_OK "both are not"
${EndIf}
SectionEnd
相关问题