轉自 http://hi.csdn.net/jinglidong

!include "LogicLib.nsh"
使用 NSIS 的宏來提供各種邏輯基本語句,不需要預先添加函數。
  • 基本語句

If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless
- 有條件的執行一個語句區塊,取決于表達式。

AndIf|AndUnless|OrIf|OrUnless
- 給 If、Unless、ElseIf 和 ElseUnless 增加額外的條件語句。

IfThen..|..|
- 有條件的執行一個內聯語句,取決于表達式。

IfCmd..||..|
- 條件的執行一個內聯語句,取決于 NSIS 函數提供的真值。

Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect
- 執行多個語句區塊之一,取決于表達式的值。

Switch..{Case|CaseElse|Default}..EndSwitch
- 跳轉到多個標記之一,取決于表達式的值。

Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]
- 重復一個語句區塊直到停止 取決于表達式的值。

While..{ExitWhile|Continue|Break}..EndWhile
- DoWhile..Loop的別名(向后兼容)

For[Each]..{ExitFor|Continue|Break}..Next
- 重復語句區塊來連續改變變量的值。

  • 表達式

標準(內建的)字串判斷(不區分大小寫):
a == b; a != b

另外的不區分大小寫的字串判斷(使用 System.dll):
a S< b; a S>= b; a S> b; a S<= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP

區分大小寫字串判斷(使用 System.dll):
a S== b; a S!= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP

標準(內建的)有符號整數判斷:
a = b; a <> b; a < b; a >= b; a > b; a <= b

標準(內建的)無符號整數判斷:
a U< b; a U>= b; a U> b; a U<= b

64位整數判斷(使用System.dll):
a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_INT64CMP

內建的NSIS標記判斷:
${Abort};
${Errors};
${RebootFlag};
${Silent}

內建的 NSIS 其它判斷:
${FileExists} a;

任何有條件的 NSIS 指令判斷:
${Cmd} a;

區段標記判斷:
${SectionIsSelected} a;
${SectionIsSectionGroup} a;
${SectionIsSectionGroupEnd} a;
${SectionIsBold} a;
${SectionIsReadOnly} a;
${SectionIsExpanded} a;
${SectionIsPartiallySelected} a;