nsis 中的复合字符串比较

compound string comparison in nsis

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

基本上是这样的:if ( str1 == "" || str2 == "" ) ...

strcpy  "c:\foo"
strcpy  "d:\bar"

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

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

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

${If}  == ""
${OrIf}  == ""
   MessageBox MB_OK "one or both are empty"
${Else}
   MessageBox MB_OK "both are not"
${EndIf}
SectionEnd