<SYSTEM>This is the full developer documentation for NSIS Documentation</SYSTEM>

# .onGUIEnd

> This callback is called right after the installer window closes. Use it to free any user interface related plug-ins if needed.

This callback is called right after the installer window closes. Use it to free any user interface related plug-ins if needed.

# .onGUIInit

> This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the user interface.

This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the user interface.

## Example

[Section titled “Example”](#example)

```plaintext
!include "WinMessages.nsh"


Function .onGUIInit
    # 1028 is the id of the branding text control
    GetDlgItem $R0 $HWNDPARENT 1028
    CreateFont $R1 "Tahoma" 10 700
    SendMessage $R0 ${WM_SETFONT} $R1 0
    # set background color to white and text color to red
    SetCtlColors $R0 FFFFFF FF0000
FunctionEnd
```

# .onInit

> This callback will be called when the installer is nearly finished initializing. If the .onInit function calls Abort, the installer will quit instantly.

This callback will be called when the installer is nearly finished initializing. If the `.onInit` function calls [`Abort`](../Commands/Abort.md), the installer will quit instantly.

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInit
    MessageBox MB_YESNO "This will install. Continue?" IDYES NoAbort
    Abort ; causes installer to quit.
    NoAbort:
FunctionEnd
```

or:

```plaintext
Function .onInit
    ReadINIStr $INSTDIR $WINDIR\wincmd.ini Configuration InstallDir
    StrCmp $INSTDIR "" 0 NoAbort
    MessageBox MB_OK "Windows Commander not found. Unable to get install path."
    Abort ; causes installer to quit.
    NoAbort:
FunctionEnd
```

# .onInstFailed

> This callback is called when the user hits the 'cancel' button after the install has failed (if it could not extract a file, or the install script used the…

This callback is called when the user hits the ‘cancel’ button after the install has failed (if it could not extract a file, or the install script used the Abort command).

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInstFailed
    MessageBox MB_OK "Better luck next time."
FunctionEnd
```

# .onInstSuccess

> This callback is called when the install was successful, right before the install window closes (which may be after the user clicks 'Close' if AutoCloseWindow…

This callback is called when the install was successful, right before the install window closes (which may be after the user clicks ‘Close’ if [`AutoCloseWindow`](../Commands/AutoCloseWindow.md) or [`SetAutoClose`](../Commands/SetAutoClose.md) is set to false).

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInstSuccess
    MessageBox MB_YESNO "Congrats, it worked. View readme?" IDNO NoReadme
    Exec notepad.exe ; view readme or whatever, if you want.
    NoReadme:
FunctionEnd
```

# .onMouseOverSection

> This callback is called whenever the mouse position over the sections tree has changed. This allows you to set a description for each section for example. The…

This callback is called whenever the mouse position over the sections tree has changed. This allows you to set a description for each section for example. The section id on which the mouse is over currently is stored, temporarily, in $0.

## Example

[Section titled “Example”](#example)

```plaintext
Function .onMouseOverSection
    FindWindow $R0 "#32770" "" $HWNDPARENT
    GetDlgItem $R0 $R0 1043 ; description item (must be added to the UI)


    StrCmp $0 0 "" +2
    SendMessage $R0 ${WM_SETTEXT} 0 "STR:first section description"


    StrCmp $0 1 "" +2
    SendMessage $R0 ${WM_SETTEXT} 0 "STR:second section description"
FunctionEnd
```

# .onRebootFailed

> This callback is called if Reboot fails. WriteUninstaller, plug-ins, File and WriteRegBin should not be used in this callback.

This callback is called if [`Reboot`](../Commands/Reboot.md) fails. [`WriteUninstaller`](../Commands/WriteUninstaller.md), plug-ins, [`File`](../Commands/File.md) and [`WriteRegBin`](../Commands/WriteRegBin.md) should not be used in this callback.

## Example

[Section titled “Example”](#example)

```plaintext
Function .onRebootFailed
    MessageBox MB_OK|MB_ICONSTOP "Reboot failed. Please reboot manually." /SD IDOK
FunctionEnd
```

# .onSelChange

> Called when the selection changes on the component page. Useful for using with SectionSetFlags and SectionGetFlags.

Called when the selection changes on the component page. Useful for using with [`SectionSetFlags`](../Commands/SectionSetFlags.md) and [`SectionGetFlags`](../Commands/SectionGetFlags.md).

Selection changes include both section selection and installation type change.

# .onUserAbort

> This callback is called when the user hits the 'cancel' button, and the install hasn't already failed. If this function calls Abort, the install will not be…

This callback is called when the user hits the ‘cancel’ button, and the install hasn’t already failed. If this function calls [`Abort`](../Commands/Abort.md), the install will not be aborted.

Example:

```plaintext
Function .onUserAbort
    MessageBox MB_YESNO "Abort install?" IDYES NoCancelAbort
    Abort ; causes installer to not quit.
    NoCancelAbort:
FunctionEnd
```

# .onVerifyInstDir

> This callback enables control over whether or not an installation path is valid for your installer. This code will be called every time the user changes the…

This callback enables control over whether or not an installation path is valid for your installer. This code will be called every time the user changes the install directory, so it shouldn’t do anything crazy with [`MessageBox`](../Commands/MessageBox.md) or the likes. If this function calls [`Abort`](../Commands/Abort.md), the installation path in [`$INSTDIR`](../Variables/INSTDIR.md) is deemed invalid.

Example:

```plaintext
Function .onVerifyInstDir
    IfFileExists $INSTDIR\Winamp.exe PathGood
    Abort ; if $INSTDIR is not a winamp directory, don't let us install there
    PathGood:
FunctionEnd
```

# un.onGUIEnd

> This callback is called right after the uninstaller window closes. Use it to free any user interface related plug-ins if needed.

This callback is called right after the uninstaller window closes. Use it to free any user interface related plug-ins if needed.

# un.onGUIInit

> This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the user interface.

This callback will be called just before the first page is loaded and the installer dialog is shown, allowing you to tweak the user interface.

## Example

[Section titled “Example”](#example)

```plaintext
!include "WinMessages.nsh"


Function un.onGUIInit
    # 1028 is the id of the branding text control
    GetDlgItem $R0 $HWNDPARENT 1028
    CreateFont $R1 "Tahoma" 10 700
    SendMessage $R0 ${WM_SETFONT} $R1 0
    # set background color to white and text color to red
    SetCtlColors $R0 FFFFFF FF0000
FunctionEnd
```

# un.onInit

> This callback will be called when the uninstaller is nearly finished initializing. If the un.onInit function calls Abort, the uninstaller will quit instantly.…

This callback will be called when the uninstaller is nearly finished initializing. If the `un.onInit` function calls [`Abort`](../Variables/INSTDIR.md), the uninstaller will quit instantly. Note that this function can verify and/or modify \[`$INSTDIR`]\[3] if necessary.

## Example

[Section titled “Example”](#example)

```plaintext
Function un.onInit
    MessageBox MB_YESNO "This will uninstall. Continue?" IDYES NoAbort
    Abort ; causes uninstaller to quit.
    NoAbort:
FunctionEnd
```

or:

```plaintext
Function un.onInit
    IfFileExists $INSTDIR\myfile.exe found
    Messagebox MB_OK "Uninstall path incorrect"
    Abort
    found:
FunctionEnd
```

# un.onRebootFailed

> This callback is called if Reboot fails. WriteUninstaller, plug-ins, File and WriteRegBin should not be used in this callback.

This callback is called if [`Reboot`](../Commands/Reboot.md) fails. [`WriteUninstaller`](../Commands/WriteUninstaller.md), plug-ins, [`File`](../Commands/File.md) and [`WriteRegBin`](../Commands/WriteRegBin.md) should not be used in this callback.

## Example

[Section titled “Example”](#example)

```plaintext
Function un.onRebootFailed
    MessageBox MB_OK|MB_ICONSTOP "Reboot failed. Please reboot manually." /SD IDOK
FunctionEnd
```

# un.onSelChange

> Called when the selection changes on the component page. Useful for using with SectionSetFlags and SectionGetFlags.

Called when the selection changes on the component page. Useful for using with [`SectionSetFlags`](../Commands/SectionSetFlags.md) and [`SectionGetFlags`](../Commands/SectionGetFlags.md).

Selection changes include both section selection and installation type change.

# un.onUninstFailed

> This callback is called when the user hits the 'cancel' button after the uninstall has failed (if it used the Abort command or otherwise failed).

This callback is called when the user hits the ‘cancel’ button after the uninstall has failed (if it used the [`Abort`](../Commands/Abort.md) command or otherwise failed).

## Example

[Section titled “Example”](#example)

```plaintext
Function un.onUninstFailed
    MessageBox MB_OK "Better luck next time."
FunctionEnd
```

# un.onUninstSuccess

> This callback is called when the uninstall was successful, right before the install window closes (which may be after the user clicks 'Close' if SetAutoClose is…

This callback is called when the uninstall was successful, right before the install window closes (which may be after the user clicks ‘Close’ if [`SetAutoClose`](../Commands/SetAutoClose.md) is set to false)..

## Example

[Section titled “Example”](#example)

```plaintext
Function un.onUninstSuccess
    MessageBox MB_OK "Congrats, it's gone."
FunctionEnd
```

# un.onUserAbort

> This callback is called when the user hits the 'cancel' button and the uninstall hasn't already failed. If this function calls Abort, the install will not be…

This callback is called when the user hits the ‘cancel’ button and the uninstall hasn’t already failed. If this function calls [`Abort`](../Commands/Abort.md), the install will not be aborted.

## Example

[Section titled “Example”](#example)

```plaintext
Function un.onUserAbort
    MessageBox MB_YESNO "Abort uninstall?" IDYES NoCancelAbort
    Abort ; causes uninstaller to not quit.
    NoCancelAbort:
FunctionEnd
```

# Abort

> Cancels the install, stops execution of script, and displays user_message in the status display. Note: you can use this from Callback functions to do special…

Cancels the install, stops execution of script, and displays user\_message in the status display. Note: you can use this from [Callback functions](http://nsis.sourceforge.net/Docs/Chapter4.html#4.7.2) to do special things. [Page callbacks](http://nsis.sourceforge.net/Docs/Chapter4.html#4.5) also uses Abort for special purposes.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_message
```

## Example

[Section titled “Example”](#example)

```plaintext
Abort
Abort "can't install"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1t

# AddBrandingImage

> Adds a branding image on the top, bottom, left, or right of the installer. Its size will be set according to the width/height specified, the installer…

Adds a branding image on the top, bottom, left, or right of the installer. Its size will be set according to the width/height specified, the installer width/height and the installers font. The final size will not always be what you requested; have a look at the output of the command for the actual size. Because this depends on the installers, you should use [`SetFont`](SetFont.md) before `AddBrandingImage`. The default padding value is 2.

`AddBrandingImage` only adds a placeholder for an image. To set the image itself at runtime, use [`SetBrandingImage`](SetBrandingImage.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
(left|right|top|bottom) (width|height) [padding]
```

## Example

[Section titled “Example”](#example)

```plaintext
AddBrandingImage left 100
AddBrandingImage right 50
AddBrandingImage top 20
AddBrandingImage bottom 35
AddBrandingImage left 100 5
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# !addincludedir

> Adds another include directory to the include directories list. This list is searched when !include is used. This list's initial value is ${NSISDIR}\Include…

Adds another include directory to the include directories list. This list is searched when [`!include`](!include.md) is used. This list’s initial value is `${NSISDIR}\Include` alone.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
directory
```

## Example

[Section titled “Example”](#example)

```plaintext
!addincludedir ..\include
!include something.nsh
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 1

# !addplugindir

> Causes the NSIS compiler to scan the given directory for plug-in DLLs.

Causes the NSIS compiler to scan the given directory for plug-in DLLs.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
directory
```

## Example

[Section titled “Example”](#example)

```plaintext
!addplugindir myplugin
MyPlugin::SomeFunction
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 1

# AddSize

> Tells the installer that the current section needs an additional "size_kb" kilobytes of disk space. Only valid within a section (will have no effect outside of…

Tells the installer that the current section needs an additional “size\_kb” kilobytes of disk space. Only valid within a section (will have no effect outside of a section or in a function).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
size_kb
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    AddSize 500
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.53

# AllowRootDirInstall

> Controls whether or not installs are allowed in the root directory of a drive, or directly into a network share. Set to 'true' to change the safe behavior,…

Controls whether or not installs are allowed in the root directory of a drive, or directly into a network share. Set to ‘true’ to change the safe behavior, which prevents users from selecting C:\ or \Server\Share as an install (and later on, uninstall) directory. For additional directory selection page customizability, see [`.onVerifyInstDir`](../Callbacks/onVerifyInstDir.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# AllowSkipFiles

> This command specifies whether the user should be able to skip a file or not. A user has an option to skip a file if SetOverwrite is set to on (default) and the…

This command specifies whether the user should be able to skip a file or not. A user has an option to skip a file if [`SetOverwrite`](SetOverwrite.md) is set to on (default) and the installer fails to open a file for writing when trying to extract a file. If off is used the ignore button which allows the user to skip the file will not show and the user will only have an option to abort the installation (Cancel button) or retry opening the file for writing (Retry button). If on is used the user will have an option to skip the file (error flag will be set - see [`SetOverwrite`](SetOverwrite.md)).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# !appendfile

> Appends text to file. The text is written as ANSI (ACP) unless the file already has a BOM. Using /CHARSET will force a specific character encoding. $\n will be…

Appends text to file. The text is written as ANSI (ACP) unless the file already has a BOM. Using `/CHARSET` will force a specific character encoding. `$\n` will be translated to `$\r$\n` on Windows unless you specify `/RawNL`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/CHARSET=ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]] [/RawNL] file text file text
```

## Example

[Section titled “Example”](#example)

```plaintext
!tempfile FILE
!appendfile "${FILE}" "XPStyle on$\n"
!appendfile "${FILE}" "Name 'test'$\n"
!include "${FILE}"
!delfile "${FILE}"
!undef FILE
```

## History

[Section titled “History”](#history)

Added in NSIS v2.11

# !assert

> This command will stop the compiler if the expression is not true. The expression is evaluated in a similar fashion to !if.

This command will stop the compiler if the expression is not true. The expression is evaluated in a similar fashion to [!if](!if.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
value [op value2] message
```

## Example

[Section titled “Example”](#example)

```plaintext
!assert ${NSIS_CHAR_SIZE} = 2 "Unicode required"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.09

# AutoCloseWindow

> Sets whether or not the install window automatically closes when completed. This is overrideable from a section using SetAutoClose.

Sets whether or not the install window automatically closes when completed. This is overrideable from a section using [`SetAutoClose`](SetAutoClose.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# BGFont

> Specifies the font used to show the text on the background gradient. To set the color use BGGradient. The default font will be used if no parameters are…

Specifies the font used to show the text on the background gradient. To set the color use [`BGGradient`](BGGradient.md). The default font will be used if no parameters are specified. The default font is bold and italic Times New Roman.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[font_face [height [weight] [/ITALIC] [/UNDERLINE] [/STRIKE]]]
```

## History

[Section titled “History”](#history)

Added in NSIS v2.01

# BGGradient

> Specifies whether or not to use a gradient background window. If 'off', the installer will not show a background window, if no parameters are specified, the…

Specifies whether or not to use a gradient background window. If ‘off’, the installer will not show a background window, if no parameters are specified, the default black to blue gradient is used, and otherwise the top\_color or bottom\_color are used to make a gradient. top\_color and bottom\_color are specified using the form RRGGBB (in hexadecimal, as in HTML, only minus the leading ’#’, since # can be used for comments). ‘textcolor’ can be specified as well, or ‘notext’ can be specified to turn the big background text off.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[off|(topc botc [textcolor|notext])]
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2f

# BrandingText

> Sets the text that is shown at the bottom of the install window (by default it is 'Nullsoft Install System vX.XX') at the bottom of the install window. Setting…

Sets the text that is shown at the bottom of the install window (by default it is ‘Nullsoft Install System vX.XX’) at the bottom of the install window. Setting this to an empty string ("") uses the default; to set the string to blank, use ” ” (a space). If it doesn’t matter to you, leave it the default so that everybody can know why the installer didn’t suck. heh. Use `/TRIMLEFT`, `/TRIMRIGHT` or `/TRIMCENTER` to trim down the size of the control to the size of the string.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
/TRIM(LEFT|RIGHT|CENTER) text
```

## History

[Section titled “History”](#history)

Added in NSIS v1.57

# BringToFront

> Makes the installer window visible and brings it to the top of the window list. If an application was executed that shows itself in front of the installer, a…

Makes the installer window visible and brings it to the top of the window list. If an application was executed that shows itself in front of the installer, a BringToFront would bring the installer back in focus.

Recent Windows versions restrict the setting of foreground windows. If the user is working with another application during installation, the user may be notified using a different method.

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# Call

> Calls the function named function_name, the label named label_name, or a variable that specifies an address. An address is returned by GetCurrentAddress,…

Calls the function named function\_name, the label named label\_name, or a variable that specifies an address. An address is returned by [`GetCurrentAddress`](GetCurrentAddress.md), [`GetFunctionAddress`](GetFunctionAddress.md) or [`GetLabelAddress`](GetLabelAddress.md). A call returns when it encounters a [`Return`](Return.md) instruction. Sections and functions are automatically ended with a Return instruction. Uninstall functions cannot be called from installer functions and sections, and vice-versa.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
function_name | :label_name | user_var(input)
```

## Example

[Section titled “Example”](#example)

```plaintext
Function func
      Call :label
      DetailPrint "#1: This will only appear 1 time."
    label:
      DetailPrint "#2: This will appear before and after message #1."
      Call :.global_label
FunctionEnd


Section
      Call func
      Return


    .global_label:
      DetailPrint "#3: The global label was called"
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.3

# CallInstDLL

> Calls a function named function_name inside a NSIS extension DLL, a plug-in. See the example plugin for how to make one. Extension DLLs can access the stack and…

Calls a function named function\_name inside a NSIS extension DLL, a plug-in. See the example plugin for how to make one. Extension DLLs can access the stack and variables. Note: To automatically extract and call plug-in DLLs, use a plug-in command instead of `CallInstDLL`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
dllfile function_name
```

## Example

[Section titled “Example”](#example)

```plaintext
Push "a parameter"
Push "another parameter"
CallInstDLL $INSTDIR\somedll.dll somefunction
```

## History

[Section titled “History”](#history)

Added in NSIS v1.7b

# Caption

> When used outside a PageEx block: Sets the text for the titlebar of the installer. By default, it is '$(^Name) Setup', where Name is specified by the Name…

When used outside a [`PageEx`](PageEx.md) block: Sets the text for the titlebar of the installer. By default, it is ’$(^Name) Setup’, where [`Name`](Name.md) is specified by the [`Name`](Name.md) instruction. You can, however, override it with ‘MyApp Installer’ or whatever. If you specify an empty string (""), the default will be used (you can however specify ” ” to simulate an empty string).

When used inside a [`PageEx`](PageEx.md) block: Sets the subcaption of the current page.

Accepts variables. If variables are used, they must be initialized on [`.onInit`](../Callbacks/onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
caption
```

## Example

[Section titled “Example”](#example)

```plaintext
PageEx license
    Caption "This is a license page"
PageExEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2f

# !cd

> This command will change the compiler to the new directory, new_path. new_path can be relative or absolute.

This command will change the compiler to the new directory, `new_path`. `new_path` can be relative or absolute.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
new_path
```

## Example

[Section titled “Example”](#example)

```plaintext
!cd ..\more-scripts\new
```

## History

[Section titled “History”](#history)

Added in NSIS v1.4

# ChangeUI

> Replaces dialog (IDD_LICENSE, IDD_DIR, IDD_SELCOM, IDD_INST, IDD_INSTFILES, IDD_UNINST or IDD_VERIFY) with a dialog from ui_file.exe`. You can also specify…

Replaces dialog (IDD\_LICENSE, IDD\_DIR, IDD\_SELCOM, IDD\_INST, IDD\_INSTFILES, IDD\_UNINST or IDD\_VERIFY) with a dialog from ui\_file.exe\`. You can also specify ‘all’ as the dialog if you wish to replace all 7 of the dialogs at once from the same UI file. For some example UIs look at Contrib\UIs under your NSIS directory.

* IDD\_LICENSE must contain IDC\_EDIT1 (RICHEDIT control).
* IDD\_DIR must contain IDC\_DIR (edit box), IDC\_BROWSE (button) and IDC\_CHECK1 (checkbox).
* IDD\_SELCOM must contain IDC\_TREE1 (SysTreeView32 control), and IDC\_COMBO1 (combo box).
* IDD\_INST must contain IDC\_BACK (button), IDC\_CHILDRECT (static control the size of all other dialogs), IDC\_VERSTR (static), IDOK (button), and IDCANCEL (button). If an image control (static with SS\_BITMAP style) will be found in this dialog it will be used as the default for [`SetBrandingImage`](SetBrandingImage.md).
* IDD\_INSTFILES must contain IDC\_LIST1 (SysListView32 control), IDC\_PROGRESS (msctls\_progress32 control), and IDC\_SHOWDETAILS (button).
* IDD\_UNINST must contain IDC\_EDIT1 (edit box).
* IDD\_VERIFY must contain IDC\_STR (static).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
dialog ui_file.exe
```

## Example

[Section titled “Example”](#example)

```plaintext
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# CheckBitmap

> Specifies the bitmap with the checkbox images used in the component-selection page treeview.

Specifies the bitmap with the checkbox images used in the component-selection page treeview.

This bitmap should have a size of 96x16 pixels, no more than 8bpp (256 colors) and contain six 16x16 images for the different states (in order: selection mask, not checked, checked, greyed out, unchecked & read-only, checked & read-only). Use magenta as mask color (this area will be transparent).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
bitmap.bmp
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 0

# ClearErrors

> Clears the error flag.

Clears the error flag.

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
IfErrors 0 +2
MessageBox MB_OK "this message box will never show"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# CompletedText

> Replaces the default text ("Completed") that is printed at the end of the install if parameter is specified. Otherwise, the default is used.

Replaces the default text (“Completed”) that is printed at the end of the install if parameter is specified. Otherwise, the default is used.

Accepts variables. If variables are used, they must be initialized before the message is printed.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
text
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# ComponentText

> Used to change the default text on the component page.

Used to change the default text on the component page.

The default string will be used if a string is empty ("").

Accepts variables. If variables are used, they must be initialized before the components page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[text [subtext] [subtext2]]
```

* text: Text above the controls, to the right of the installation icon.
* subtext: Text next to the installation type selection.
* subtext2: Text to the left of the components list and below the installation type.

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# CopyFiles

> Copies files from the source to the destination on the installing system. Useful with $EXEDIR if you want to copy from installation media, or to copy from one…

Copies files from the source to the destination on the installing system. Useful with [`$EXEDIR`](../Variables/EXEDIR.md) if you want to copy from installation media, or to copy from one place to another on the system. You might see a Windows status window of the copy operation if the operation takes a lot of time (to disable this, use `/SILENT`). The last parameter can be used to specify the size of the files that will be copied (in kilobytes), so that the installer can approximate the disk space requirements. On error, or if the user cancels the copy (only possible when `/SILENT` was omitted), the error flag is set. The error flag is not set if a destination file already exists; instead, the destination file is overwritten. If `/FILESONLY` is specified, only files are copied.

Fully-qualified path names should always be used with this instruction. Using relative paths will have unpredictable results.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/SILENT] [/FILESONLY] filespec_on_destsys destination_path [size_of_files_in_kb]
```

## Example

[Section titled “Example”](#example)

```plaintext
CreateDirectory $INSTDIR\backup
CopyFiles $INSTDIR\*.dat $INSTDIR\backup
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# CRCCheck

> Specifies whether or not the installer will perform a CRC on itself before allowing an install. Note that if the user uses /NCRC on the command line when…

Specifies whether or not the installer will perform a CRC on itself before allowing an install. Note that if the user uses `/NCRC` on the command line when executing the installer, and you didn’t specify ‘force’, the CRC will not occur, and the user will be allowed to install a (potentially) corrupted installer.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off|force
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# CreateDirectory

> Creates (recursively if necessary) the specified directory. The error flag is set if the directory couldn't be created. You should always specify an absolute…

Creates (recursively if necessary) the specified directory. The error flag is set if the directory couldn’t be created. You should always specify an absolute path.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
path_to_create
```

## Example

[Section titled “Example”](#example)

```plaintext
CreateDirectory $INSTDIR\some\directory
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# CreateFont

> Creates a font and puts its handle into user_var. For more information about the different parameters have a look at MSDN's page about the Win32 API function…

Creates a font and puts its handle into user\_var. For more information about the different parameters have a look at MSDN’s page about the Win32 API function [CreateFont()](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_8fp0.asp). You can get the current font used by NSIS using the ^Font and ^FontSize [`LangString`](LangString.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(handle output) face_name [height] [weight] [/ITALIC] [/UNDERLINE] [/STRIKE]
```

## Example

[Section titled “Example”](#example)

```plaintext
CreateDirectory $INSTDIR\some\directory
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 7

# CreateShortCut

> Creates a shortcut 'link.lnk' that links to 'target.file', with optional parameters 'parameters'. The icon used for the shortcut is…

Creates a shortcut ‘link.lnk’ that links to ‘target.file’, with optional parameters ‘parameters’. The icon used for the shortcut is ‘icon.file,icon\_index\_number’; for default icon settings use empty strings for both icon.file and icon\_index\_number. start\_options should be one of: SW\_SHOWNORMAL, SW\_SHOWMAXIMIZED, SW\_SHOWMINIMIZED, or an empty string. keyboard\_shortcut should be in the form of ‘flag|c’ where flag can be a combination (using |) of: ALT, CONTROL, EXT, or SHIFT. c is the character to use (a-z, A-Z, 0-9, F1-F24, etc). Note that no spaces are allowed in this string. A good example is “ALT|CONTROL|F8”. [`$OUTDIR`](../Variables/OUTDIR.md) is used for the working directory. You can change it by using [`SetOutPath`](SetOutPath.md) before creating the Shortcut. description should be the description of the shortcut, or comment as it is called under XP. The error flag is set if the shortcut cannot be created (i.e. either of the paths (link or target) does not exist, or some other error).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
CreateDirectory $INSTDIR\some\directory
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !define

> This command will add gflag to the global define list. This will have a similar effect as using the /D switch on the command line (the define only becomes…

This command will add gflag to the global define list. This will have a similar effect as using the `/D` switch on the command line (the define only becomes effective after the `!define` command). If `/date` or `/utcdate` are used, value will be passed into strftime and the result will be used as the value of gflag. strftime converts special symbols into certain parts of the current time or date. For example, %H will be converted into the current hour in 24-hour format. For a complete list of available symbols, search for strftime on [MSDN](http://msdn.microsoft.com/). On POSIX, you can get the list by using man strftime. If `/math` is used, the result of ‘val1 OP val2’, where OP may be +,-,\*,&,|,^,/ or % , will be used as the value of gflag. Note that val1 AND val2 MUST be integer values! If `/file` is used, the entire text file specified (including whitespace and newlines) will be read and stuffed into gflag.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/ifndef | /redef] ([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt)
```

## Example

[Section titled “Example”](#example)

```plaintext
!define USE_SOMETHING
!define VERSION 1.2
!define /date NOW "%H:%M:%S %d %b, %Y"
!define /math RESULT 3 + 10
!define /math REST 15 % ${RESULT}
!define /file BUNCHASTUFF somesourcefile.cpp
!define /redef USE_SOMETHING ${RESULT} ;redefine USE_SOMETHING
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1f

# Delete

> Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If /REBOOTOK is specified and the file cannot be…

Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If `/REBOOTOK` is specified and the file cannot be deleted then the file is deleted when the system reboots — if the file will be deleted on a reboot, the reboot flag will be set. The error flag is set if files are found and cannot be deleted. The error flag is not set from trying to delete a file that does not exist.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/REBOOTOK] file
```

## Example

[Section titled “Example”](#example)

```plaintext
Delete $INSTDIR\somefile.dat
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# DeleteINISec

> Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If /REBOOTOK is specified and the file cannot be…

Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If `/REBOOTOK` is specified and the file cannot be deleted then the file is deleted when the system reboots — if the file will be deleted on a reboot, the reboot flag will be set. The error flag is set if files are found and cannot be deleted. The error flag is not set from trying to delete a file that does not exist.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ini_filename section_name
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteINIStr $TEMP\something.ini section1 something 123
WriteINIStr $TEMP\something.ini section1 somethingelse 1234
WriteINIStr $TEMP\something.ini section2 nsis true
DeleteINISec $TEMP\something.ini section1
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1u

# DeleteINIStr

> Deletes the string str_name from section [section_name] from ini_filename. If the string could not be removed from the ini file, the error flag is set. It does…

Deletes the string str\_name from section \[section\_name] from ini\_filename. If the string could not be removed from the ini file, the error flag is set. It does not set the error flag if the string could not be found.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ini_filename section_name str_name
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteINIStr $TEMP\something.ini section1 something 123
WriteINIStr $TEMP\something.ini section1 somethingelse 1234
DeleteINIStr $TEMP\something.ini section1 somethingelse
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1u

# DeleteRegKey

> Deletes a registry key. If /ifempty is specified, the registry key will only be deleted if it has no subkeys (otherwise, the whole registry tree will be…

Deletes a registry key. If `/ifempty` is specified, the registry key will only be deleted if it has no subkeys (otherwise, the whole registry tree will be removed). Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). The error flag is set if the key could not be removed from the registry (or if it didn’t exist to begin with).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/ifempty] root_key subkey
```

## Example

[Section titled “Example”](#example)

```plaintext
DeleteRegKey HKLM "Software\My Company\My Software"
DeleteRegKey /ifempty HKLM "Software\A key that might have subkeys"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# DeleteRegValue

> Deletes a registry value. Valid values for root_key are listed under WriteRegStr. The error flag is set if the value could not be removed from the registry (or…

Deletes a registry value. Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). The error flag is set if the value could not be removed from the registry (or if it didn’t exist to begin with).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name
```

## Example

[Section titled “Example”](#example)

```plaintext
DeleteRegValue HKLM "Software\My Company\My Software" "some value"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !delfile

> This command deletes a file on compile time.

This command deletes a file on compile time.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
file
```

## Example

[Section titled “Example”](#example)

```plaintext
!tempfile FILE
!delfile "${FILE}"
!undef FILE
```

## History

[Section titled “History”](#history)

Added in NSIS v2.11

# DetailPrint

> Adds the string "user_message" to the details view of the installer.

Adds the string “user\_message” to the details view of the installer.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_message
```

## Example

[Section titled “Example”](#example)

```plaintext
DetailPrint "this message will show on the installation window"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.32

# DetailsButtonText

> Replaces the default details button text of "Show details", if parameter is specified (otherwise the default is used). Accepts variables. If variables are used,…

Replaces the default details button text of “Show details”, if parameter is specified (otherwise the default is used). Accepts variables. If variables are used, they must be initialized before the install log (instfiles) page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
show_details_text
```

## Example

[Section titled “Example”](#example)

```plaintext
DetailPrint "this message will show on the installation window"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# DirText

> Used to change the default text on the directory page.

Used to change the default text on the directory page.

The default string will be used if a string is empty ("").

Accepts variables. If variables are used, they must be initialized before the directory page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[text] [subtext] [browse_button_text] [browse_dlg_text]
```

* text: Text above the controls, to the right of the installation icon.
* subtext: Text on the directory selection frame.
* browse\_button\_text: Text on the Browse button.
* browse\_dlg\_text: Text on the “Browse For Folder” dialog, appears after clicking on “Browse” button.

## Example

[Section titled “Example”](#example)

```plaintext
DetailPrint "this message will show on the installation window"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# DirVar

> Specifies which variable is to be used to contain the directory selected. This variable should be initialized with a default value. This allows you to easily…

Specifies which variable is to be used to contain the directory selected. This variable should be initialized with a default value. This allows you to easily create two different directory pages that will not require you to move values in and out of [`$INSTDIR`](../Variables/INSTDIR.md). The default variable is [`$INSTDIR`](../Variables/INSTDIR.md). This can only be used in [`PageEx`](PageEx.md) and for directory and uninstConfirm pages.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(dir input/output)
```

## Example

[Section titled “Example”](#example)

```plaintext
Var ANOTHER_DIR
PageEx directory
    DirVar $ANOTHER_DIR
PageExEnd


Section
    SetOutPath $INSTDIR
    File "a file.dat"
    SetOutPath $ANOTHER_DIR
    File "another file.dat"
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# DirVerify

> If 'DirVerify leave' is used, the Next button will not be disabled if the installation directory is not valid or there is not enough space. A flag that you can…

If ‘DirVerify leave’ is used, the Next button will not be disabled if the installation directory is not valid or there is not enough space. A flag that you can read in the leave function using [`GetInstDirError`](GetInstDirError.md) will be set instead.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
auto|leave
```

## Example

[Section titled “Example”](#example)

```plaintext
PageEx directory
    DirVerify leave
    PageCallbacks "" "" dirLeave
PageExEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 1

# !echo

> This command will echo a message to the user compiling the script.

This command will echo a message to the user compiling the script.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
message
```

## Example

[Section titled “Example”](#example)

```plaintext
!echo "hello world"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# !else

> This command allows to easily insert different code when different defines or macros are set. You can create blocks like !ifdef/!else/!endif, !ifdef/!else…

This command allows to easily insert different code when different defines or macros are set. You can create blocks like [`!ifdef`](!ifdef.md)/`!else`/[`!endif`](!endif.md), [`!ifdef`](!ifdef.md)/`!else` [`!ifdef`](!ifdef.md)/`!else`/[`!endif`](!endif.md) etc.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[if|ifdef|ifndef|ifmacrodef|ifmacrondef [...]]
```

## Example

[Section titled “Example”](#example)

```plaintext
!ifdef VERSION
    OutFile installer-${VERSION}.exe
!else
    OutFile installer.exe
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1f

# EnableWindow

> Enables or disables mouse and keyboard input to the specified window or control. Possible states are 0 (disabled) or 1 (enabled).

Enables or disables mouse and keyboard input to the specified window or control. Possible states are 0 (disabled) or 1 (enabled).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
hwnd (1|0)
```

## Example

[Section titled “Example”](#example)

```plaintext
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
Sleep 1000
EnableWindow $0 1
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# !endif

> This command closes a block started with !if, !ifdef, !ifndef, !ifmacrodef or !ifmacrondef.

This command closes a block started with [`!if`](!if.md), [`!ifdef`](!ifdef.md), [`!ifndef`](!ifndef.md), [`!ifmacrodef`](!ifmacrodef.md) or [`!ifmacrondef`](!ifmacrondef.md).

## Example

[Section titled “Example”](#example)

```plaintext
!ifdef VERSION
    OutFile installer-${VERSION}.exe
!else
    OutFile installer.exe
!endif


!ifmacrodef MACRO
    DetailPrint "Macro defined"
!else
    DetailPrint "Macro not defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1f

# EnumRegKey

> Set user variable $x with the name of the 'index'th registry key in root_key\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty…

Set user variable $x with the name of the ‘index’th registry key in root\_key\Subkey. Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). Returns an empty string if there are no more keys, and returns an empty string and sets the error flag if there is an error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) root_key subkey index
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0
loop:
  EnumRegKey $1 HKLM Software $0
  StrCmp $1 "" done
  IntOp $0 $0 + 1
  MessageBox MB_YESNO|MB_ICONQUESTION "$1$\n$\nMore?" IDYES loop
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# EnumRegValue

> Set user variable $x with the name of the 'index'th registry value in root_key\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty…

Set user variable $x with the name of the ‘index’th registry value in root\_key\Subkey. Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). Returns an empty string and sets the error flag if there are no more values or if there is an error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) root_key subkey index
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0
loop:
  ClearErrors
  EnumRegValue $1 HKLM Software\Microsoft\Windows\CurrentVersion $0
  IfErrors done
  IntOp $0 $0 + 1
  ReadRegStr $2 HKLM Software\Microsoft\Windows\CurrentVersion $1
  MessageBox MB_YESNO|MB_ICONQUESTION "$1 = $2$\n$\nMore?" IDYES loop
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# !error

> This command will issue an error to the script compiler and will stop execution of the script. You can also add a message to this error.

This command will issue an error to the script compiler and will stop execution of the script. You can also add a message to this error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
message
```

## Example

[Section titled “Example”](#example)

```plaintext
!ifdef VERSION & NOVERSION
    !error "both VERSION and NOVERSION are defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1u

# Exch

> When no parameter is specified, exchanges the top two elements of the stack. When a parameter is specified and is a user variable, exchanges the top element of…

When no parameter is specified, exchanges the top two elements of the stack. When a parameter is specified and is a user variable, exchanges the top element of the stack with the parameter. When a parameter is specified and is a positive integer, `Exch` will swap the item on the top of the stack with the item that is specified by the offset from the top of the stack in the parameter. If there are not enough items on the stack to accomplish the exchange, a fatal error will occur (to help you debug your code :).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[user_var | stack_index]
```

## Example

[Section titled “Example”](#example)

```plaintext
Push 1
Push 2
Exch
Pop $0 # = 1
Push 1
Push 2
Push 3
Exch 2
Pop $0 # = 1
StrCpy $0 1
Push 2
Exch $0 # = 2
Pop $1 # = 1
```

## History

[Section titled “History”](#history)

Added in NSIS v1.58

# Exec

> Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used…

Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. [`$OUTDIR`](../Variables/OUTDIR.md) is used for the working directory.

The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: Exec ’“$INSTDIR\command.exe” parameters’. If you don’t put it in quotes it will not work on Windows 9x with or without parameters.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command
```

## Example

[Section titled “Example”](#example)

```plaintext
Exec '"$INSTDIR\someprogram.exe"'
Exec '"$INSTDIR\someprogram.exe" some parameters'
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# ExecShell

> Execute the specified program using ShellExecute. Note that action is usually "open", "print", etc, but can be an empty string to use the default action.…

Execute the specified program using ShellExecute. Note that action is usually “open”, “print”, etc, but can be an empty string to use the default action. Parameters and the show type are optional. [`$OUTDIR`](../Variables/OUTDIR.md) is used for the working directory. The error flag is set if the process could not be launched.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE]
```

## Example

[Section titled “Example”](#example)

```plaintext
ExecShell "open" "http://nsis.sf.net/"
ExecShell "open" "$INSTDIR\readme.txt"
ExecShell "print" "$INSTDIR\readme.txt"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1b

# ExecShellWait

> Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used…

Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. [`$OUTDIR`](../Variables/OUTDIR.md) is used as the working directory. The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: `Exec '"$INSTDIR\command.exe" parameters'`. If you don’t put it in quotes it will not work on Windows 9x with or without parameters.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/INVOKEIDLIST] action command [parameters] [SW_SHOWDEFAULT | SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE]
```

## Example

[Section titled “Example”](#example)

```plaintext
ExecShellWait "open" "http://nsis.sf.net/"
ExecShellWait "open" "$INSTDIR\readme.txt"
ExecShellWait "print" "$INSTDIR\readme.txt"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.02

# !execute

> This command will execute 'command' using a call to CreateProcess(). Unlike !system, it does not use the command line processor, so input/output redirection and…

This command will execute ‘command’ using a call to *CreateProcess()*. Unlike [`!system`](!system.md), it does not use the command line processor, so input/output redirection and commands like ‘cd’, ‘dir’ and ‘type’ can not be used. `!execute` also ignores the return value of the executed command. Currently, the only known advantage of `!execute` over [`!system`](!system.md) is that it does not give trouble when the current working directory is specified using UNC. On POSIX platforms, `!execute` will use *system()* just like [`!system`](!system.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command
```

## Example

[Section titled “Example”](#example)

```plaintext
!execute '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
```

## History

[Section titled “History”](#history)

Added in NSIS v2.01

# ExecWait

> Execute the specified program and wait for the executed process to quit. See Exec for more information. If no output variable is specified ExecWait sets the…

Execute the specified program and wait for the executed process to quit. See [`Exec`](Exec.md) for more information. If no output variable is specified `ExecWait` sets the error flag if the program executed returns a nonzero error code, or if there is an error. If an output variable is specified, `ExecWait` sets the variable with the exit code (and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined). Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: ExecWait ’“$INSTDIR\command.exe” parameters’. If you don’t put it in quotes it will not work on Windows 9x with or without parameters.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command [user_var(exit code)]
```

## Example

[Section titled “Example”](#example)

```plaintext
ExecWait '"$INSTDIR\someprogram.exe"'
ExecWait '"$INSTDIR\someprogram.exe"' $0
DetailPrint "some program returned $0"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# ExpandEnvStrings

> Expands environment variables in string into the user variable $x. If an environment variable doesn't exist, it will not be replaced. For example, if you use…

Expands environment variables in string into the user variable $x. If an environment variable doesn’t exist, it will not be replaced. For example, if you use “%var%” and var doesn’t exists, the result will be “%var”. If there is an error, the variable is set to empty, and the error flag is set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) string
```

## Example

[Section titled “Example”](#example)

```plaintext
ExpandEnvStrings $0 "WINDIR=%WINDIR%$\nTEMP=%TEMP%"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# File

> Adds file(s) to be extracted to the current output path ($OUTDIR).

Adds file(s) to be extracted to the current output path ([`$OUTDIR`](../Variables/OUTDIR.md)).

* Note that the output file name is $OUTDIR\filename\_portion\_of\_file.
* Use `/oname=X` switch to change the output name. X may contain variables and can be a fully qualified path or a relative path in which case it will be appended to [`$OUTDIR`](../Variables/OUTDIR.md) set by [`SetOutPath`](SetOutPath.md). When using this switch, only one file can be specified. If the output name contains spaces, quote the entire parameter, including /oname, as shown in the examples below.
* Wildcards are supported.
* If the `/r` switch is used, matching files and directories are recursively searched for in subdirectories. If just one path segment is specified (e.g. File /r something), the current directory will be recursively searched. If more than one segment is specified (e.g. File /r something\*.\*), the last path segment will be used as the matching condition and the rest for the directory to search recursively. If a directory name matches, all of its contents is added recursively. Directory structure is preserved.
* Use the `/x`switch to exclude files or directories.
* If the `/a` switch is used, the attributes of the file(s) added will be preserved.
* The `File` command sets the error flag if overwrite mode is set to ‘try’ and the file could not be overwritten, or if the overwrite mode is set to ‘on’ and the file could not be overwritten and the user selects ignore.
* If the `/nonfatal` switch is used and no files are found, a warning will be issued instead of an error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/nonfatal] [/a] ([/r] [/x file|wildcard [...]] (file|wildcard) [...] | /oname=file.dat infile.dat)
```

## Example

[Section titled “Example”](#example)

```plaintext
File something.exe
File /a something.exe
File *.exe
File /r *.dat
File /r data
File /oname=temp.dat somefile.ext
File /oname=$TEMP\temp.dat somefile.ext
File "/oname=$TEMP\name with spaces.dat" somefile.ext
File /nonfatal "a file that might not exist"
File /r /x CVS myproject\*.*
File /r /x *.res /x *.obj /x *.pch source\*.*
```

**Note:** when using the `/r` switch, both matching directories and files will be searched. This is always done with or without the use of wildcards, even if the given path perfectly matches one directory. That means, the following directory structure:

```plaintext
something/
├── file.dat
└── another.dat
dir/
├── something
├── dir2/
│   └── file2.dat
└── another/
    └── something/
        └── readme.txt
```

with the following `File` usage:

```plaintext
File /r something
```

will match the directory named something on the root directory, the file named something in the directory named dir and the directory named something in the directory named another. To match only the directory named something on the root directory, use the following:

```plaintext
File /r something\*.*
```

When adding \*.\*, it will be used as the matching condition and something will be used as the directory to search. When only something is specified, the current directory will be recursively searched for every and directory named something and another\something will be matched.

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# FileBufSize

> This command sets the size of the compiler's internal file buffers. This command allows you to control the compiler's memory usage by limiting how much of a…

This command sets the size of the compiler’s internal file buffers. This command allows you to control the compiler’s memory usage by limiting how much of a given file it will load into memory at once. Since the compiler needs both input and output, twice the memory size specified could be used at any given time for file buffers. This command does not limit the compression buffers which could take another couple of MB, neither does it limit the compiler’s other internal buffers, but those shouldn’t normally top 1MB anyway. Specifying a very small number could decrease performance. Specifying a very large number could exhaust system resources and force the compiler to cancel the compilation process. The default value is 32MB.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
buffer_size_in_mb
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# FileClose

> Closes a file handle opened with FileOpen.

Closes a file handle opened with [`FileOpen`](FileOpen.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle
```

## Example

[Section titled “Example”](#example)

```plaintext
FileOpen $0 $INSTDIR\file.dat r
FileClose $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileErrorText

> Replaces the default text that comes up when a file cannot be written to. This string can contain a reference to $0, which is the filename ($0 is temporarily…

Replaces the default text that comes up when a file cannot be written to. This string can contain a reference to `$0`, which is the filename (`$0` is temporarily changed to this value). Example: “Can not write to file $\r$\n$0$\r$\ngood luck.”.

Accepts variables. If variables are used, they must be initialized before [`File`](File.md) is used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
text
```

## History

[Section titled “History”](#history)

Added in NSIS v1.63beta

# FileOpen

> Opens a file named "filename", and sets the handle output variable with the handle. The openmode should be one of "r" (read) "w" (write, all contents of file…

Opens a file named “filename”, and sets the handle output variable with the handle. The openmode should be one of “r” (read) “w” (write, all contents of file are destroyed) or “a” (append, meaning opened for both read and write, contents preserved). In all open modes, the file pointer is placed at the beginning of the file. If the file cannot be opened, the handle output is set to empty, and the error flag is set.

If no absolute path is specified the current folder will be used. The current folder is the folder set using the last `SetOutPath` instruction. If you have not used [`SetOutPath`](SetOutPath.md) the current folder is [`$EXEDIR`](SetOutPath.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(handle output) filename openmode
```

## Example

[Section titled “Example”](#example)

```plaintext
FileOpen $0 $INSTDIR\file.dat r
FileClose $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileRead

> Reads a string (ANSI characters) from a file opened with FileOpen. The string is read until either a newline (or carriage return newline pair) occurs, or until…

Reads a string (ANSI characters) from a file opened with [`FileOpen`](FileOpen.md). The string is read until either a newline (or carriage return newline pair) occurs, or until a null byte is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS\_MAX\_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.

(If you are building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4), the function reads an ANSI string and makes the adequate conversion)

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle user_var(output) [maxlen]
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat r
IfErrors done
FileRead $0 $1
DetailPrint $1
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileReadByte

> Reads a byte from a file opened with FileOpen. The byte is stored in the output as an integer (0-255). If the end of file is read and no more data is available,…

Reads a byte from a file opened with [`FileOpen`](FileOpen.md). The byte is stored in the output as an integer (0-255). If the end of file is read and no more data is available, the output will be empty, and the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat r
IfErrors done
FileReadByte $0 $1
FileReadByte $0 $2
DetailPrint "$1 $2"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# FileReadUTF16LE

> This function is only available when building a Unicode installer.

This function is only available when building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4).

Reads a string (UTF-16LE characters) from a file opened with [`FileOpen`](FileOpen.md). The string is read until either a newline (or carriage return newline pair) occurs, or until a null wide-character is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS\_MAX\_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat r
IfErrors done
FileReadByte $0 $1
FileReadByte $0 $2
DetailPrint "$1 $2"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# FileReadUTF16LE

> This function is only available when building a Unicode installer.

This function is only available when building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4).

Reads a word (2-bytes) from a file opened with [`FileOpen`](FileOpen.md). The word is stored in the output as an integer (0-65535). If the end of file is read and no more data is available, the output will be empty, and the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat r
IfErrors done
FileReadWord $0 $1
FileReadWord $0 $2
DetailPrint "$1 $2"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# FileSeek

> Seeks a file opened with FileOpen. If mode is omitted or specified as SET, the file is positioned to "offset", relative to the beginning of the file. If mode is…

Seeks a file opened with [`FileOpen`](FileOpen.md). If mode is omitted or specified as SET, the file is positioned to “offset”, relative to the beginning of the file. If mode is specified as CUR, then the file is positioned to “offset”, relative to the current file position. If mode is specified as END, then the file is positioned to “offset”, relative to the end of the file. If the final parameter “new position” is specified, the new file position will be stored to that variable.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle offset [mode] [user_var(new position)]
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat r
IfErrors done
FileSeek $0 -5 END
FileRead $0 $1
DetailPrint $1
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileWrite

> Writes an ANSI string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.

Writes an ANSI string to a file opened with [`FileOpen`](FileOpen.md). If an error occurs writing, the error flag will be set.

(If you are building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4), the function makes the adequate conversion and writes an ANSI string)

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle string
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat w
IfErrors done
FileWrite $0 "some text"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileWrite

> Writes an ANSI string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.

Writes an ANSI string to a file opened with [`FileOpen`](FileOpen.md). If an error occurs writing, the error flag will be set.

(If you are building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4), the function makes the adequate conversion and writes an ANSI string)

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle string
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat w
IfErrors done
FileWrite $0 "some text"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FileWriteUTF16LE

> This function is only available when building a Unicode installer.

This function is only available when building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4).

Writes a Unicode (UTF-16LE) string to a file opened with [`FileOpen`](FileOpen.md). If an error occurs writing, the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle string
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
FileOpen $0 $INSTDIR\file.dat w
IfErrors done
FileWriteUTF16LE $0 "some text"
FileClose $0
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# FileWriteWord

> This function is only available when building a Unicode installer.

This function is only available when building a [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#1.4).

Writes the integer interpretation of ‘string’ as a WORD (2-bytes, range: 0-65535) to a file opened with [`FileOpen`](FileOpen.md). Of course you can enter the integer value directly. The following code writes a “Carriage Return / Line Feed” - Enter to the file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle string
```

## Example

[Section titled “Example”](#example)

```plaintext
FileWriteWord file_handle "13"
FileWriteWord file_handle "10"
```

If an error occurs while writing, the error flag will be set. Note that the low WORD of the integer is used, i.e. writing 65536 is the same as writing 0, etc.

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# !finalize

> This option will execute 'command' using a call to system() after the output EXE has been generated. You can typically use it to sign (Authenticode) your…

This option will execute ‘command’ using a call to *system()* after the output EXE has been generated. You can typically use it to sign (Authenticode) your installer. If ‘command’ contains a ‘%1’ it will be replaced by the executable filename. On POSIX platforms, `!execute` will use *system()* just like [`!system`](!system.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command
```

## Example

[Section titled “Example”](#example)

```plaintext
!finalize 'sign.bat "%1" "Product Installer" http://example.com'
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# FindClose

> Closes a search opened with FindFirst.

Closes a search opened with [`FindFirst`](FindFirst.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle
```

## Example

[Section titled “Example”](#example)

```plaintext
FindFirst $0 $1 $INSTDIR\*.txt
loop:
  StrCmp $1 "" done
  DetailPrint $1
  FindNext $0 $1
  Goto loop
done:
FindClose $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FindFirst

> Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output…

Performs a search for ‘filespec’, placing the first file found in filename\_output (a user variable). It also puts the handle of the search into handle\_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with [`FindNext`](FindNext.md) and [`FileClose`](FileClose.md). Note that the filename output is without path.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(handle output) user_var(filename output) filespec
```

## Example

[Section titled “Example”](#example)

```plaintext
FindFirst $0 $1 $INSTDIR\*.txt
loop:
  StrCmp $1 "" done
  DetailPrint $1
  FindNext $0 $1
  Goto loop
done:
FindClose $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FindNext

> Continues a search began with FindFirst. handle should be the handle_output_variable returned by FindFirst. If the search is completed (there are no more…

Continues a search began with [`FindFirst`](FindFirst.md). handle should be the handle\_output\_variable returned by [`FindFirst`](FindFirst.md). If the search is completed (there are no more files), filename\_output is set to empty, and the error flag is set. Note that the filename output is without path.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
handle user_var(filename_output)
```

## Example

[Section titled “Example”](#example)

```plaintext
FindFirst $0 $1 $INSTDIR\*.txt
loop:
  StrCmp $1 "" done
  DetailPrint $1
  FindNext $0 $1
  Goto loop
done:
FindClose $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# FindWindow

> Searches for a window. Behaves like the win32 FindWindowEx(). Searches by windowclass (and/or windowtitle if specified). If windowparent or childafter are…

Searches for a window. Behaves like the win32 FindWindowEx(). Searches by windowclass (and/or windowtitle if specified). If windowparent or childafter are specified, the search will be restricted as such. If windowclass or windowtitle is specified as "", they will not be used for the search. If the window is not found, the user variable returned is 0. To accomplish old-style FindWindow behavior, use FindWindow with [`SendMessage`](SendMessage.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(hwnd output) windowclass [windowtitle] [windowparent] [childafter]
```

## Example

[Section titled “Example”](#example)

```plaintext
FindWindow $0 "#32770" "" $HWNDPARENT
FindWindow $0 "my window class" "my window title"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# FlushINI

> Flushes the INI file's buffers. Windows 9x keeps all changes to the INI file in memory. This command causes the changes to be written to the disk immediately.…

Flushes the INI file’s buffers. Windows 9x keeps all changes to the INI file in memory. This command causes the changes to be written to the disk immediately. Use it if you edit the INI manually, delete it, move it or copy it right after you change it with [`WriteINIStr`](WriteINIStr.md), [`DeleteINISec`](DeleteINISec.md) or [`DeleteINStr`](DeleteINIStr.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ini_filename
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteINIStr $TEMP\something.ini test test test
FlushINI $TEMP\something.ini
Delete $TEMP\something.ini
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 3

# Function

> Begins and opens a new function. Function names beginning with "." (e.g. ".Whatever") are generally reserved for callback functions. Function names beginning…

Begins and opens a new function. Function names beginning with ”.” (e.g. ”.Whatever”) are generally reserved for callback functions. Function names beginning with “un.” are functions that will be generated in the Uninstaller. Hence, normal install Sections and functions cannot call uninstall functions, and the Uninstall Section and uninstall functions cannot call normal functions.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[function_name]
```

## Example

[Section titled “Example”](#example)

```plaintext
Function func
    # some commands
FunctionEnd


Section
    Call func
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.3

# FunctionEnd

> This command closes the current open Function.

This command closes the current open [`Function`](Function.md).

## Example

[Section titled “Example”](#example)

```plaintext
Function func
    # some commands
FunctionEnd


Section
    Call func
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.3

# GetCurInstType

> Get the current InstType and stores it in user_var. If the first install type is selected, 0 will be put in user_var. If the second install type is selected, 1…

Get the current [`InstType`](InstType.md) and stores it in user\_var. If the first install type is selected, 0 will be put in user\_var. If the second install type is selected, 1 will be put in user\_var, and so on. The value of `${NSIS_MAX_INST_TYPES}` (32 by default) means that the custom install type was selected.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# GetCurrentAddress

> Gets the address of the current instruction and stores it in the output user variable. This user variable then can be passed to Call or Goto.

Gets the address of the current instruction and stores it in the output user variable. This user variable then can be passed to [`Call`](Call.md) or [`Goto`](Goto.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
Function func
    DetailPrint "function"
    IntOp $0 $0 + 2
    Call $0
    DetailPrint "function end"
FunctionEnd


Section
  DetailPrint "section"
  DetailPrint "section"
  GetCurrentAddress $0
  Goto callFunc


  DetailPrint "back to section"
  Return


callFunc:
  Call func
  DetailPrint "section end"
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# GetDlgItem

> Retrieves the handle of a control identified by item_id in the specified dialog box dialog. If you want to get the handle of a control on the inner dialog,…

Retrieves the handle of a control identified by item\_id in the specified dialog box dialog. If you want to get the handle of a control on the inner dialog, first use

```plaintext
FindWindow user_var(output) "#32770" "" `$HWNDPARENT
```

to get the handle of the inner dialog.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) dialog item_id
```

## Example

[Section titled “Example”](#example)

```plaintext
GetDlgItem $0 $HWNDPARENT 1 # next/install button
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# GetDLLVersion

> Gets the version information from the DLL (or any other executable containing version information) in "filename". Sets the user output variables with the high…

Gets the version information from the DLL (or any other executable containing version information) in “filename”. Sets the user output variables with the high and low dwords of version information on success; on failure the outputs are empty and the error flag is set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
filename user_var(high dword output) user_var(low dword output)
```

## Example

[Section titled “Example”](#example)

The following example reads the DLL version and copies a human readable version of it into \`$0:

```plaintext
GetDlgItem $0 $HWNDPARENT 1 # next/install button
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# GetDLLVersionLocal

> This is similar to GetDLLVersion, only it acts on the system building the installer (it actually compiles into two StrCpy commands). Sets the two output…

This is similar to [`GetDLLVersion`](GetDLLVersion.md), only it acts on the system building the installer (it actually compiles into two [`StrCpy`](StrCpy.md) commands). Sets the two output variables with the DLL version information of the DLL on the build system.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
localfilename user_var(high dword output) user_var(low dword output)
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# GetErrorLevel

> Returns the last error level set by SetErrorLevel or -1 if it was never used.

Returns the last error level set by [`SetErrorLevel`](SetErrorLevel.md) or -1 if it was never used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(error level output)
```

## Example

[Section titled “Example”](#example)

```plaintext
GetErrorLevel $0
IntOp $0 $0 + 1
SetErrorLevel $0
```

## History

[Section titled “History”](#history)

Added in NSIS v2.02

# GetFileTime

> Gets the last write time of "filename". Sets the user output variables with the high and low dwords of the timestamp on success; on failure the outputs are…

Gets the last write time of “filename”. Sets the user output variables with the high and low dwords of the timestamp on success; on failure the outputs are empty and the error flag is set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
filename user_var(high dword output) user_var(low dword output)
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# GetFileTimeLocal

> This is similar to GetFileTime, only it acts on the system building the installer (it actually compiles into two StrCpy commands). Sets the two output variables…

This is similar to [`GetFileTime`](GetFileTime.md), only it acts on the system building the installer (it actually compiles into two [`StrCpy`](StrCpy.md) commands). Sets the two output variables with the file timestamp of the file on the build system.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
filename user_var(high dword output) user_var(low dword output)
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# GetFullPathName

> Assign to the user variable $x, the full path of the file specified. If the path portion of the parameter is not found, the error flag will be set and $x will…

Assign to the user variable $x, the full path of the file specified. If the path portion of the parameter is not found, the error flag will be set and $x will be empty. If `/SHORT` is specified, the path is converted to the short filename form. However, if `/SHORT` is not specified, the path isn’t converted to its long filename form. To get the long filename, call GetLongPathName using the System plug-in. Note that GetLongPathName is only available on Windows 98, Windows 2000 and above.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/SHORT] user_var(output) path_or_file
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $INSTDIR $PROGRAMFILES\NSIS
SetOutPath $INSTDIR
GetFullPathName $0 ..
DetailPrint $0 # will print C:\Program Files
GetFullPathName /SHORT $0 $INSTDIR
DetailPrint $0 # will print C:\Progra~1\NSIS
```

Using GetLongPathName:

```plaintext
StrCpy $0 C:\Progra~1\NSIS
System::Call 'kernel32::GetLongPathName(t r0, t .r1, i ${NSIS_MAX_STRLEN}) i .r2'
StrCmp $2 error +2
StrCpy $0 $1
DetailPrint $0 # will print C:\Program Files\NSIS, where supported
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# GetFunctionAddress

> Gets the address of the function and stores it in the output user variable. This user variable then can be passed to Call or Goto. Note that if you Goto an…

Gets the address of the function and stores it in the output user variable. This user variable then can be passed to [`Call`](Call.md) or [`Goto`](Goto.md). Note that if you [`Goto`](Goto.md) an address which is the output of `GetFunctionAddress`, your function will never be returned to (when the function you Goto’d to returns, you return instantly).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) function_name
```

## Example

[Section titled “Example”](#example)

```plaintext
Function func
    DetailPrint "function"
FunctionEnd


Section
    GetFunctionAddress $0 func
    Call $0
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# GetInstDirError

> Use in the leave function of a directory page. Reads the flag set if 'DirVerify leave' is used. Possible values:

Use in the leave function of a directory page. Reads the flag set if ‘DirVerify leave’ is used. Possible values:

* 0: No error
* 1: Invalid installation directory
* 2: Not enough space on installation drive

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(error output)
```

## Example

[Section titled “Example”](#example)

```plaintext
!include LogicLib.nsh
PageEx directory
    DirVerify leave
    PageCallbacks "" "" dirLeave
PageExEnd


Function dirLeave
    GetInstDirError $0
    ${Switch} $0
        ${Case} 0
            MessageBox MB_OK "valid installation directory"
            ${Break}
        ${Case} 1
            MessageBox MB_OK "invalid installation directory!"
            Abort
            ${Break}
        ${Case} 2
            MessageBox MB_OK "not enough free space!"
            Abort
            ${Break}
    ${EndSwitch}
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 1

# GetKnownFolderPath

> Get the path of a known folder. The error flag is set and the output variable is empty if the call fails or the knownfolderid guid is not available. This…

Get the path of a [known folder](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). The error flag is set and the output variable is empty if the call fails or the `knownfolderid` guid is not available. This function is only able to resolve known folders on Windows Vista or higher.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) knownfolderid
```

## Example

[Section titled “Example”](#example)

```plaintext
!include WinCore.nsh
!include LogicLib.nsh


Function .onInit
    ${If} $InstDir == ""
        GetKnownFolderPath $InstDir ${FOLDERID_UserProgramFiles} ; This exists on Win7+
        StrCmp $InstDir "" 0 +2
        StrCpy $InstDir "$LocalAppData\Programs" ; Fallback directory
        StrCpy $InstDir "$InstDir\$(^Name)"
    ${EndIf}
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v3.06

# GetLabelAddress

> Gets the address of the label and stores it in the output user variable. This user variable then can be passed to Call or Goto. Note that you may only call this…

Gets the address of the label and stores it in the output user variable. This user variable then can be passed to [`Call`](Call.md) or [`Goto`](Goto.md). Note that you may only call this with labels accessible from your function, but you can call it from anywhere (which is potentially dangerous). Note that if you [`Call`](Call.md) the output of `GetLabelAddress`, code will be executed until it [`Return`](Return.md)’s (explicitly or implicitly at the end of a function), and then you will be returned to the statement after the [`Call`](Call.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) label
```

## Example

[Section titled “Example”](#example)

```plaintext
!include LogicLib.nsh
PageEx directory
    DirVerify leave
    PageCallbacks "" "" dirLeave
PageExEnd


Function dirLeave
    GetInstDirError $0
    ${Switch} $0
        ${Case} 0
            MessageBox MB_OK "valid installation directory"
            ${Break}
        ${Case} 1
            MessageBox MB_OK "invalid installation directory!"
            Abort
            ${Break}
        ${Case} 2
            MessageBox MB_OK "not enough free space!"
            Abort
            ${Break}
    ${EndSwitch}
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# GetTempFileName

> Assign to the user variable $x, the name of a temporary file. The file will have been created, so you can then overwrite it with what you please. The name of…

Assign to the user variable $x, the name of a temporary file. The file will have been created, so you can then overwrite it with what you please. The name of the temporary file is guaranteed to be unique. If to want the temporary file to be created in another directory than the Windows temp directory, specify a base\_dir. [`Delete`](Delete.md) the file when done with it.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) base_dir
```

## Example

[Section titled “Example”](#example)

```plaintext
GetTempFileName $0
File /oname=$0 something.dat
# do something with something.dat
Delete $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.90

# !gettlbversion

> Get the version information from a .TLB file.

Get the version information from a .TLB file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/noerrors] [/packed] localfilename define_basename
```

## Example

[Section titled “Example”](#example)

```plaintext
!gettlbversion /packed "$%WINDIR%\System32\stdole32.tlb" TLBVER_
!echo "${TLBVER_HIGH}.${TLBVER_LOW}"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# GetWinVer

> Gets the Windows version as reported by GetVersionEx. WinVer.nsh is the preferred method for performing Windows version checks.

Gets the Windows version as reported by GetVersionEx. `WinVer.nsh` is the preferred method for performing Windows version checks.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) Major|Minor|Build|ServicePack
```

## Example

[Section titled “Example”](#example)

```plaintext
GetWinVer $1 Build
```

## History

[Section titled “History”](#history)

Added in NSIS v3.08

# Goto

> If label is specified, goto the label 'label_to_jump_to:'.

If label is specified, goto the label ‘label\_to\_jump\_to:’.

If `+offset` or `-offset` is specified, jump is relative by offset instructions. Goto +1 goes to the next instruction, Goto -1 goes to the previous instruction, etc.

If a user variable is specified, jumps to absolute address (generally you will want to get this value from a function like [`GetLabelAddress`](GetLabelAddress.md)). Compiler flag commands and SectionIn aren’t instructions so jumping over them has no effect.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
label_to_jump_to | +offset| -offset| user_var(target)
```

## Example

[Section titled “Example”](#example)

```plaintext
Goto label
Goto +2
Goto -2
Goto $0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.4 Beta

# HideWindow

> Hides the installer.

Hides the installer.

## History

[Section titled “History”](#history)

Added in NSIS v1.1b

# Icon

> Sets the icon of the installer. Every image in the icon file will be included in the installer. Use UninstallIcon to set the uninstaller icon.

Sets the icon of the installer. Every image in the icon file will be included in the installer. Use [`UninstallIcon`](UninstallIcon.md) to set the uninstaller icon.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[path\]icon.ico
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !if

> This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If value is non-zero, or…

This command, when paired with an [`!endif`](!endif.md) command, will tell the compiler whether or not to compile the lines in between the two lines. If value is non-zero, or the comparison of value and value2 depending on the operator results in true, the contained lines will be compiled. Otherwise, they will be skipped. op can be either `==` or `!=` (string comparison), `<=`, `< >` or `>=` (float comparison), `&` (bitwise AND comparison), `&&` or `||` (boolean comparison). If \[!] is set, return value will be switched from true to false and vice versa.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[!] value [op value2]
```

## Example

[Section titled “Example”](#example)

```plaintext
!if 1 < 2
  !echo "1 is smaller than 2!!"
!else if ! 3.1 > 1.99
  !error "this line should never appear"
!else
  !error "neither should this"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v2.15

# IfAbort

> If Abort is called it will "return" true. This can happen if the user chose abort on a file that failed to create (or overwrite) or if the user aborted by hand.…

If [`Abort`](Abort.md) is called it will “return” true. This can happen if the user chose abort on a file that failed to create (or overwrite) or if the user aborted by hand. This function can only be called from the leave function of the instfiles page.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
label_to_goto_if_abort [label_to_goto_if_no_abort]
```

## Example

[Section titled “Example”](#example)

```plaintext
Page instfiles "" "" instfilesLeave


Function instfilesLeave
    IfAbort 0 +2
    MessageBox MB_OK "user aborted"
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# !ifdef

> This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If gflag is globally…

This command, when paired with an [`!endif`](!endif.md) command, will tell the compiler whether or not to compile the lines in between the two lines. If gflag is globally defined (using [`!define`](!define.md) or the `/D` switch), then the contained lines will be compiled. Otherwise, they will be skipped. ‘bcheck’ can be specified as `&` (boolean and) or `|` (boolean or) along with more gflags — precedence is simple, left to right.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
gflag [bcheck gflag [...]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
!define SOMETHING
!ifdef SOMETHING
    !echo "SOMETHING is defined"
!endif


!undef SOMETHING
!ifdef SOMETHING
    !echo "SOMETHING is defined" # will never be printed
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1f

# IfErrors

> Checks and clears the error flag, and if it is set, it will Goto jumpto_iferror, otherwise it will Goto jumpto_ifnoerror. The error flag is set by other…

Checks and clears the error flag, and if it is set, it will [`Goto`](Goto.md) jumpto\_iferror, otherwise it will [`Goto`](Goto.md) jumpto\_ifnoerror. The error flag is set by other instructions when a recoverable error (such as trying to delete a file that is in use) occurs.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
jumpto_iferror [jumpto_ifnoerror]
```

## Example

[Section titled “Example”](#example)

```plaintext
ClearErrors
File file.dat
IfErrors 0 +2
Call ErrorHandler
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# IfFileExists

> Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and Goto jump_if_present if the file exists, otherwise Goto…

Checks for existence of file(s) file\_to\_check\_for (which can be a wildcard, or a directory), and [`Goto`](Goto.md) jump\_if\_present if the file exists, otherwise [`Goto`](Goto.md) jump\_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\*

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
file_to_check_for jump_if_present [jump_otherwise]
```

## Example

[Section titled “Example”](#example)

```plaintext
IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"
```

You can also use labels, which may help make your code easier to read:

```plaintext
IfFileExists $INSTDIR\somefile.txt file_found file_not_found


file_found:
MessageBox MB_OK "somefile.txt was found"
Goto done


file_not_found:
MessageBox MB_OK "somefile.txt was not found"


done:
; ...
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1n

# !ifmacrodef

> This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If the macro gflag…

This command, when paired with an [`!endif`](!endif.md) command, will tell the compiler whether or not to compile the lines in between the two lines. If the macro gflag exists, then the contained lines will be compiled. Otherwise, they will be skipped. ‘bcheck’ can be specified as `&` (boolean and) or `|` (boolean or) along with more gflags — precedence is simple, left to right.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
gflag [bcheck gflag [...]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
!macro SomeMacro
!macroend
!ifmacrodef SomeMacro
  !echo "SomeMacro is defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# !ifmacrondef

> The opposite of !ifmacrodef. The lines will be compiled when the macro gflag does not exist. This command, when paired with an !endif command, will tell the…

The opposite of [`!ifmacrodef`](!ifmacrodef.md). The lines will be compiled when the macro gflag does not exist. This command, when paired with an [`!endif`](!endif.md) command, will tell the compiler whether or not to compile the lines in between the two lines. If the macro gflag exists, then the contained lines will be compiled. Otherwise, they will be skipped. ‘bcheck’ can be specified as `&` (boolean and) or `|` (boolean or) along with more gflags — precedence is simple, left to right.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
gflag [bcheck gflag [...]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
!ifmacrondef SomeMacro
    !echo "SomeMacro is not defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# !ifndef

> The opposite of !ifdef. This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines.…

The opposite of [`!ifdef`](!ifdef.md). This command, when paired with an [`!endif`](!endif.md) command, will tell the compiler whether or not to compile the lines in between the two lines. If gflag is globally defined (using [`!define`](!define.md) or the `/D` switch), then the contained lines will be compiled. Otherwise, they will be skipped. ‘bcheck’ can be specified as `&` (boolean and) or `|` (boolean or) along with more gflags — precedence is simple, left to right.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
gflag [bcheck gflag [...]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
!define SOMETHING
!ifdef SOMETHING
    !echo "SOMETHING is defined"
!endif


!undef SOMETHING
!ifndef SOMETHING
    !echo "SOMETHING is not defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1f

# IfRebootFlag

> Checks the reboot flag, and jumps to jump_if_set if the reboot flag is set, otherwise jumps to jump_if_not_set. The reboot flag can be set by Delete and Rename,…

Checks the reboot flag, and jumps to jump\_if\_set if the reboot flag is set, otherwise jumps to jump\_if\_not\_set. The reboot flag can be set by [`Delete`](Delete.md) and [`Rename`](Rename.md), or manually with [`SetRebootFlag`](SetRebootFlag.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
jump_if_set [jump_if_not_set]
```

## Example

[Section titled “Example”](#example)

```plaintext
IfRebootFlag 0 noreboot
MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" IDNO noreboot
Reboot
noreboot:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# IfRtlLanguage

> Checks if active language is a RTL language.

Checks if active language is a RTL language.

**Warning:** Do not call this in `[un].onInit` because the language file has not been fully initialized.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
jump_if_true [jump_if_false]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.06

# IfShellVarContextAll

> Checks if SetShellVarContext is set to all.

Checks if [`SetShellVarContext`](SetShellVarContext.md) is set to all.

**Warning:** Do not call this in `[un].onInit` because the language file has not been fully initialized.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
jump_if_true [jump_if_false]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.06

# IfSilent

> Checks the silent flag, and jumps to jump_if_silent if the installer is silent, otherwise jumps to jump_if_not. The silent flag can be set by SilentInstall,…

Checks the silent flag, and jumps to jump\_if\_silent if the installer is silent, otherwise jumps to jump\_if\_not. The silent flag can be set by [`SilentInstall`](SilentInstall.md), [`SilentUninstall`](SilentUnInstall.md), [`SetSilent`](SetSilent.md) and by the user passing `/S` on the command line.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
jump_if_set [jump_if_not_set]
```

## Example

[Section titled “Example”](#example)

```plaintext
IfSilent +2
ExecWait '"$INSTDIR\nonsilentprogram.exe"'
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# !include

> This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still…

This command will include ‘file’ as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can’t find the file it will look for it in every include directory. See [`!addincludedir`](!addincludedir.md) for more information. If the `/NONFATAL` switch is used and no files are found, a warning will be issued instead of an error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/NONFATAL] file
```

## Example

[Section titled “Example”](#example)

```plaintext
!include WinMessages.nsh
!include Library.nsh
!include C:\MyConfig.nsi
!include ..\MyConfig.nsh
!include /NONFATAL file_that_may_exist_or_not.nsh
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1d

# InitPluginsDir

> Initializes the plug-ins directory $PLUGINSDIR if not already initialized.

Initializes the plug-ins directory [`$PLUGINSDIR`](../Variables/PLUGINSDIR.md) if not already initialized.

## Example

[Section titled “Example”](#example)

```plaintext
InitPluginsDir
File /oname=$PLUGINSDIR\image.bmp image.bmp
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 0

# !insertmacro

> Inserts the contents of a macro that was created with !macro. If the macro was created with parameters, then you must pass as many parameters to the macro as it…

Inserts the contents of a macro that was created with [`!macro`](!macro.md). If the macro was created with parameters, then you must pass as many parameters to the macro as it requires.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
macro_name [parameter] [...]
```

## Example

[Section titled “Example”](#example)

```plaintext
!macro Print text
    DetailPrint "${text}"
!macroend
!insertmacro Print "some text"
!insertmacro Print "some more text"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.8b3

# InstallButtonText

> If parameter is specified, overrides the default install button text (of "Install") with the specified text.

If parameter is specified, overrides the default install button text (of “Install”) with the specified text.

Accepts variables. If variables are used, they must be initialized before the install button shows.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
install_button_text
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# InstallColors

> Sets the colors to use for the install info screen (the default is 00FF00 000000. Use the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#',…

Sets the colors to use for the install info screen (the default is 00FF00 000000. Use the form RRGGBB (in hexadecimal, as in HTML, only minus the leading ’#’, since # can be used for comments). Note that if `/windows` is specified as the only parameter, the default windows colors will be used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
/windows | (foreground_color background_color)
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2f

# InstallDir

> Sets the default installation directory. See the variables section for variables that can be used to make this string (especially $PROGRAMFILES). Note that the…

Sets the default installation directory. See the variables section for variables that can be used to make this string (especially [`$PROGRAMFILES`](../Variables/PROGRAMFILES.md)). Note that the part of this string following the last \ will be used if the user selects ‘browse’, and may be appended back on to the string at install time (to disable this, end the directory with a \ (which will require the entire parameter to be enclosed with quotes). If this doesn’t make any sense, play around with the browse button a bit.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
definstdir
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# InstallDirRegKey

> This attribute tells the installer to check a string in the registry and use it as the install dir if that string is valid. If this attribute is present, it…

This attribute tells the installer to check a string in the registry and use it as the install dir if that string is valid. If this attribute is present, it will override the [`InstallDir`](InstallDir.md) attribute if the registry key is valid, otherwise it will fall back to the [`InstallDir`](InstallDir.md) value. When querying the registry, this command will automatically remove any quotes. If the string ends in “.exe”, it will automatically remove the filename component of the string (i.e. if the string is “C:\Program Files\Foo\app.exe”, it will know to use “C:\Program Files\Foo”). For more advanced install directory configuration, set [`$INSTDIR`](../Variables/INSTDIR.md) in [`.onInit`](../Callbacks/onInit.md).

Language strings and variables cannot be used with `InstallDirRegKey`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name
```

## Example

[Section titled “Example”](#example)

```plaintext
InstallDirRegKey HKLM Software\NSIS ""
InstallDirRegKey HKLM Software\ACME\Thingy InstallLocation
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# InstProgressFlags

> Valid values for flag are "smooth" (smooth the progress bar) or "colored" (color the progress bar with the colors set by InstallColors.

Valid values for flag are “smooth” (smooth the progress bar) or “colored” (color the progress bar with the colors set by [`InstallColors`](InstallColors.md).

Note: neither “smooth” or “colored” work with [`XPStyle`](XPStyle.md) on when the installer runs on Windows XP with a modern theme.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[flag [...]]
```

## Example

[Section titled “Example”](#example)

```plaintext
InstProgressFlags #default old-school windows look
InstProgressFlags smooth" #new smooth look
InstProgressFlags smooth colored #colored smooth look whee
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# InstType

> Adds an install type to the install type list, or disables the custom install type. There can be as many as 32 types, each one specifying the name of the…

Adds an install type to the install type list, or disables the custom install type. There can be as many as 32 types, each one specifying the name of the install type. If the name is prefixed with ‘un.’ it is an uninstaller install type. The name can contain variables which will be processed at runtime before the components page shows. Another way of changing the InstType name during runtime is the [`InstTypeSetText`](InstTypeSetText.md) command. The difference is that with [`InstTypeSetText`](InstTypeSetText.md) you are saving your precious user variables. The first type is the default (generally ‘Typical’). If the `/NOCUSTOM` switch is specified, then the “custom” install type is disabled, and the user has to choose one of the pre-defined install types. Alternatively, if the `/CUSTOMSTRING` switch is specified, the parameter will override the “Custom” install type text. Alternatively, if the `/COMPONENTSONLYONCUSTOM` flag is specified, the component list will only be shown if the “Custom” install type is selected.

Accepts variables for type names. If variables are used, they must be initialized before the components page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# InstTypeGetText

> Gets the Text of the specified InstType.

Gets the Text of the specified [`InstType`](InstType.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
inst_type_idx user_var
```

## Example

[Section titled “Example”](#example)

```plaintext
InstType a
InstType b


Function .onInit
    InstTypeGetText 0 $0
    DetailPrint $0 # prints 'a'
    InstTypeGetText 1 $0
    DetailPrint $0 # prints 'b'
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# InstTypeSetText

> Sets the Text of the specified InstType. If the Text is empty than the InstType is removed. By using a previously unused inst_type_idx number you can create new…

Sets the Text of the specified [`InstType`](InstType.md). If the Text is empty than the [`InstType`](InstType.md) is removed. By using a previously unused inst\_type\_idx number you can create new [`InstType`](InstType.md). To add/remove [`Section`](Section.md) to this new [`InstType`](InstType.md) see [`SectionSetInstTypes`](SectionSetInstTypes.md). Unlike [`SectionIn`](SectionIn.md) the index is zero based, which means the first install type’s index is 0.

Gets the Text of the specified [`InstType`](InstType.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
inst_type_idx text
```

## Example

[Section titled “Example”](#example)

```plaintext
InstType a
InstType b


Function .onInit
    InstTypeGetText 0 $0
    DetailPrint $0 # prints 'a'
    InstTypeGetText 1 $0
    DetailPrint $0 # prints 'b'
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# Int64Cmp

> This function is only available when building a 64-bit installer.

*This function is only available when building a 64-bit installer.*

Compares two integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more. Same as [IntCmp](IntCmp.md), but treats the values as 64-bit integers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# Int64CmpU

> This function is only available when building a 64-bit installer.

*This function is only available when building a 64-bit installer.*

Compares two unsigned integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more. Performs the comparison as unsigned integers. Same as [IntCmpU](IntCmpU.md), but treats the values as 64-bit integers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# Int64Fmt

> This function is only available when building a 64-bit installer.

*This function is only available when building a 64-bit installer.*

Formats the number in “numberstring” using the format “format”, and sets the output to user variable $x. Example format strings include “%08X” “%u”

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) format numberstring
```

## Example

[Section titled “Example”](#example)

```plaintext
Int64Fmt $0 "%I64x" 244837743786702
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# IntCmp

> Compares two integers val1 and val2. If val1 and val2 are equal, Goto jump_if_equal, otherwise if val1 < val2, Goto jump_if_val1_less, otherwise if val1 > val2,…

Compares two integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## Example

[Section titled “Example”](#example)

```plaintext
IntCmp $0 5 is5 lessthan5 morethan5
is5:
  DetailPrint "$$0 == 5"
  Goto done
lessthan5:
  DetailPrint "$$0 < 5"
  Goto done
morethan5:
  DetailPrint "$$0 > 5"
  Goto done
done:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# IntCmpU

> Compares two unsigned integers val1 and val2. If val1 and val2 are equal, Goto jump_if_equal, otherwise if val1 < val2, Goto jump_if_val1_less, otherwise if…

Compares two unsigned integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more. Performs the comparison as unsigned integers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# IntFmt

> Formats the number in "numberstring" using the format "format", and sets the output to user variable $x. Example format strings include "%08X" "%u"

Formats the number in “numberstring” using the format “format”, and sets the output to user variable $x. Example format strings include “%08X” “%u”

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) format numberstring
```

## Example

[Section titled “Example”](#example)

```plaintext
IntFmt $0 "0x%08X" 195948557
IntFmt $0 "%c" 0x41
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60b

# IntOp

> Combines value1 and (depending on OP) value2 into the specified user variable (user_var). OP is defined as one of the following:

Combines value1 and (depending on OP) value2 into the specified user variable (user\_var). OP is defined as one of the following:

* ”+” ADDs value1 and value2
* ”-” SUBTRACTs value2 from value1
* ”∗” MULTIPLIEs value1 and value2
* ”/” DIVIDEs value1 by value2
* ”%” MODULUSs value1 by value2
* ”|” BINARY ORs value1 and value2
* ”&” BINARY ANDs value1 and value2
* ”^” BINARY XORs value1 and value2
* ”>>” RIGHT SHIFTs value1 by value2
* ”<<” LEFT SHIFTs value1 by value2
* ”\~” BITWISE NEGATEs value1 (i.e. 7 becomes 4294967288)
* ”!” LOGICALLY NEGATEs value1 (i.e. 7 becomes 0)
* ”||” LOGICALLY ORs value1 and value2
* ”&&” LOGICALLY ANDs value1 and value2

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) value1 OP [value2]
```

## Example

[Section titled “Example”](#example)

```plaintext
IntOp $0 1 + 1
IntOp $0 $0 + 1
IntOp $0 $0 << 2
IntOp $0 $0 ~
IntOp $0 $0 & 0xF
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# IntPtrCmp

> Compares two integers val1 and val2. If val1 and val2 are equal, Goto jump_if_equal, otherwise if val1 < val2, Goto jump_if_val1_less, otherwise if val1 > val2,…

Compares two integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more. Same as [IntCmp](IntCmp.md), but treats the values as pointer sized integers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# IntPtrCmpU

> Compares two integers val1 and val2. If val1 and val2 are equal, Goto jump_if_equal, otherwise if val1 < val2, Goto jump_if_val1_less, otherwise if val1 > val2,…

Compares two integers val1 and val2. If val1 and val2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise if val1 < val2, [`Goto`](Goto.md) jump\_if\_val1\_less, otherwise if val1 > val2, [`Goto`](Goto.md) jump\_if\_val1\_more. Same as [IntCmpU](IntCmpU.md), but treats the values as pointer sized integers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# IntPtrOp

> Combines value1 and (depending on OP) value2 into the specified user variable (user_var). OP is the same list of operators as supported by IntOp.

Combines value1 and (depending on OP) value2 into the specified user variable (`user_var`). OP is the same list of operators as supported by [`IntOp`](IntOp.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) value1 OP [value2]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.03

# IsWindow

> If HWND is a window, Goto jump_if_window, otherwise, Goto jump_if_not_window (if specified).

If HWND is a window, [`Goto`](Goto.md) jump\_if\_window, otherwise, [`Goto`](Goto.md) jump\_if\_not\_window (if specified).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
HWND jump_if_window [jump_if_not_window]
```

## Example

[Section titled “Example”](#example)

```plaintext
GetDlgItem $0 $HWNDPARENT 1
IsWindow $0 0 +3
MessageBox MB_OK "found a window"
Goto +2
MessageBox MB_OK "no window"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.51

# LangString

> Defines a multilingual string. This means its value may be different (or not, it's up to you) for every language. It allows you to easily make your installer…

Defines a multilingual string. This means its value may be different (or not, it’s up to you) for every language. It allows you to easily make your installer multilingual without the need to add massive switches to the script.

Each language string has a name that identifies it and a value for each language used by the installer. They can be used in any runtime string in the script. To use a language string all you need to add to the string is `$(LangString_name_here)` where you want the `LangString` to be inserted.

Notes:

* Unlike defines that use curly braces - {}, language strings use parenthesis - ().
* If you change the language in the [`.onInit`](../Callbacks/onInit.md) function, note that language strings in [`.onInit`](../Callbacks/onInit.md) will still use the detected language based on the user’s default Windows language, because the language is initialized after [`.onInit`](../Callbacks/onInit.md).
* Always set language strings for every language in your script.
* If you set the language ID to 0 the last used language by `LangString` or [`LoadLanguageFile`](LoadLanguageFile.md) will be used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
name language_id string
```

## Example

[Section titled “Example”](#example)

```plaintext
LangString message ${LANG_ENGLISH} "English message"
LangString message ${LANG_FRENCH} "French message"
LangString message ${LANG_KOREAN} "Korean message"


MessageBox MB_OK "A translated message: $(message)"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 2

# LicenseBkColor

> Sets the background color of the license data. Color is specified using the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#', since # can be…

Sets the background color of the license data. Color is specified using the form RRGGBB (in hexadecimal, as in HTML, only minus the leading ’#’, since # can be used for comments). Default is `/gray`. You can also use the Windows OS defined color by using `/windows`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
color | /gray | /windows
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# LicenseData

> Specifies a text file or a RTF file to use for the license that the user can read. Omit this to not have a license displayed. Note that the file must be in DOS…

Specifies a text file or a RTF file to use for the license that the user can read. Omit this to not have a license displayed. Note that the file must be in DOS text format (\r\n). To define a multilingual license data use [`LicenseLangString`](LicenseLangString.md).

If you are using a RTF file it is recommended that you edit it with WordPad and not MS Word. Using WordPad will result in a much smaller file.

Use [`LicenseLangString`](LicenseLangString.md) to show a different license for every language.

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# LicenseForceSelection

> Specifies if the displayed license must be accept explicit or not. This can be done either by a checkbox or by radiobuttons. By default the "next button" is…

Specifies if the displayed license must be accept explicit or not. This can be done either by a checkbox or by radiobuttons. By default the “next button” is disabled and will only be enabled if the checkbox is enabled or the correct radio button is selected. If off is specified the “next button” is enabled by default.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
(checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)
```

## Example

[Section titled “Example”](#example)

```plaintext
LicenseForceSelection checkbox
LicenseForceSelection checkbox "i accept"
LicenseForceSelection radiobuttons
LicenseForceSelection radiobuttons "i accept"
LicenseForceSelection radiobuttons "i accept" "i decline"
LicenseForceSelection radiobuttons "" "i decline"
LicenseForceSelection off
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# LicenseLangString

> Does the same as LangString only it loads the string from a text/RTF file and defines a special LangString that can be used only by LicenseData.

Does the same as [`LangString`](LangString.md) only it loads the string from a text/RTF file and defines a special [`LangString`](LangString.md) that can be used only by [`LicenseData`](LicenseData.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
name language_id license_path
```

## Example

[Section titled “Example”](#example)

```plaintext
LicenseLangString license ${LANG_ENGLISH} license-english.txt
LicenseLangString license ${LANG_FRENCH} license-french.txt
LicenseLangString license ${LANG_GERMAN} license-german.txt
LicenseData $(license)
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# LicenseText

> Used to change the default text on the license page.

Used to change the default text on the license page.

The default string will be used if a string is empty ("").

Accepts variables. If variables are used, they must be initialized before the license page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[text [button_text]]
```

* text: Text above the controls, to the right of the installation icon.
* button\_text: Text on the “I Agree” button.

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# LoadAndSetImage

> Loads and sets a image on a static control. ctrl is the handle of the control. imagetype must 0 for bitmaps and 1 for icons (and the control style must match…

Loads and sets a image on a static control. ctrl is the handle of the control. `imagetype` must 0 for bitmaps and 1 for icons (and the control style must match the image type). `lrflags` should be 0x10 to load from a file or 0 to load from a resource. `imageid` specifies the file path or resource name. Use `/EXERESOURCE` to load a resource from the installer .EXE. Use `/STRINGID` if `imageid` is a string, otherwise it is interpreted as a number. Use `/RESIZETOFIT[WIDTH|HEIGHT]` to resize the image to the dimensions of the control. `imagehandle` can optionally receive the handle of the loaded image.

Images loaded on individual pages should be destroyed to minimize resource leaks. If images are loaded into the same control multiple times, the previous image will only be destroyed if it is a bitmap image. Previous icons and 32-bit ARGB bitmaps must be retrieved with `STM_GETIMAGE` and destroyed.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/EXERESOURCE] [/STRINGID] [/RESIZETOFIT[WIDTH|HEIGHT]] ctrl imagetype lrflags imageid [user_var(imagehandle)]
```

## Example

[Section titled “Example”](#example)

```plaintext
LoadAndSetImage /EXERESOURCE $hIconStatic 1 0 103
LoadAndSetImage /STRINGID /RESIZETOFITWIDTH $hBmpStatic 0 0x10 "$PluginsDir\myimg.bmp"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.05

# LoadLanguageFile

> Loads a language file for the construction of a language table. All of the language files that come with NSIS are in Contrib\Language Files After you have…

Loads a language file for the construction of a language table. All of the language files that come with NSIS are in Contrib\Language Files After you have inserted the language file `${LANG_langfile}` will be defined as the language id (for example, `${LANG_ENGLISH}` will be defined as 1033). Use it with [`LangString`](LangString.md), [`LicenseLangString`](LicenseLangString.md), [`LangDLL`](LangDLL.md) and [`VIAddVersionKey`](VIAddVersionKey.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
language_file.nlf
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 3

# LockWindow

> LockWindow on prevents the main window from redrawing itself upon changes. When LockWindow off is used, all controls that weren't redrawn since LockWindow on…

`LockWindow` on prevents the main window from redrawing itself upon changes. When `LockWindow off` is used, all controls that weren’t redrawn since `LockWindow on` will be redrawn. This makes the pages flickering look nicer because now it flickers a group of controls at the same time, instead of one control at a time. The individual control flickering is more noticeable on old computers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# LogSet

> Sets whether install logging to install.log will happen. $INSTDIR must have a value before you call this function or it will not work. Note that the…

Sets whether install logging to install.log will happen. [`$INSTDIR`](../Variables/INSTDIR.md) must have a value before you call this function or it will not work. Note that the NSIS\_CONFIG\_LOG build setting must be set (scons NSIS\_CONFIG\_LOG=yes) on compile time (it is not by default) to support this.

See [Building NSIS](http://nsis.sourceforge.net/Docs//AppendixG.html#G) for more information about recompiling NSIS.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# LogText

> If installer logging is enabled, inserts text "text" into the log file.

If installer logging is enabled, inserts text “text” into the log file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
text
```

## Example

[Section titled “Example”](#example)

```plaintext
IfFileExists $WINDIR\notepad.exe 0 +2
LogText "$$WINDIR\notepad.exe exists"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 2

# !macro

> Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !insertmacro. !macro…

Creates a macro named ‘macro\_name’. All lines between the `!macro` and the [`!macroend`](!macroend.md) will be saved. To insert the macro later on, use [`!insertmacro`](!insertmacro.md). `!macro` definitions can have one or more parameters defined. The parameters may be accessed the same way a [`!define`](!define.md) would (e.g. `${PARAMNAME}`) from inside the macro.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
`macro_name [parameter] [...]`
```

## Example

[Section titled “Example”](#example)

```plaintext
!macro SomeMacro parm1 parm2 parm3
    DetailPrint "${parm1}"
    MessageBox MB_OK "${parm2}"
    File "${parm3}"
!macroend
```

## History

[Section titled “History”](#history)

Added in NSIS v1.8b3

# !macroend

> Ends a macro that was started with !macro.

Ends a macro that was started with [`!macro`](!macro.md).

## Example

[Section titled “Example”](#example)

```plaintext
!macro SomeMacro parm1 parm2 parm3
    DetailPrint "${parm1}"
    MessageBox MB_OK "${parm2}"
    File "${parm3}"
!macroend
```

## History

[Section titled “History”](#history)

Added in NSIS v1.8b3

# !makensis

> This command will !execute a new instance of MakeNSIS with the parameters you specify.

This command will [`!execute`](!execute.md) a new instance of MakeNSIS with the parameters you specify.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
parameters [compare comparevalue | symbol]
```

## Example

[Section titled “Example”](#example)

```plaintext
!makensis '-DGENERATEUNINST "${__FILE__}"' = 0
!system '"signtool" sign ...' = 0
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0b1

# ManifestDPIAware

> Declare that the installer is DPI-aware. A DPI-aware application is not scaled by the DWM (DPI virtualization) so the text is never blurry. NSIS does not scale…

Declare that the installer is DPI-aware. A DPI-aware application is not scaled by the DWM (DPI virtualization) so the text is never blurry. NSIS does not scale the bitmap used by the tree control on the component page and some plugins might have compatibility issues so make sure that you test your installer at different DPI settings if you select true.

See [MSDN](http://msdn.microsoft.com/en-us/library/dd464660) for more information about DPI-aware applications.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
notset|true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# ManifestLongPathAware

> Declare that the installer can handle paths longer than MAX_PATH. Only supported on Windows 10 Anniversary Update and later.

Declare that the installer can handle paths longer than `MAX_PATH`. Only supported on Windows 10 Anniversary Update and later.

**Note:** Instructions like [`CopyFiles`](CopyFiles.md) and [`CreateShortcut`](CreateShortcut.md) do not support long paths!

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
notset|true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v3.05

# ManifestMaxVersionTested

> Added in NSIS v3.05

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
maj.min.bld.rev
```

## History

[Section titled “History”](#history)

Added in NSIS v3.05

# ManifestSupportedOS

> Declare that the installer is compatible with the specified Windows version(s). This adds a SupportedOS entry in the compatibility section of the application…

Declare that the installer is compatible with the specified Windows version(s). This adds a SupportedOS entry in the compatibility section of the application manifest. The default is Win7+8+8.1+10. none is the default if [`RequestExecutionLevel`](RequestExecutionLevel.md) is set to none for compatibility reasons.

You can read more about the changes in behavior on [MSDN](http://msdn.microsoft.com/en-us/library/windows/desktop/hh848036).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
none|all|WinVista|Win7|Win8|Win10|{GUID} [...]
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# MessageBox

> Displays a MessageBox containing the text "messagebox_text". mb_option_list must be one or more of the following, delimited by |s (e.g. MB_YESNO|MB_ICONSTOP).

Displays a `MessageBox` containing the text “messagebox\_text”. mb\_option\_list must be one or more of the following, delimited by |s (e.g. MB\_YESNO|MB\_ICONSTOP).

* MB\_OK - Display with an OK button
* MB\_OKCANCEL - Display with an OK and a cancel button
* MB\_ABORTRETRYIGNORE - Display with abort, retry, ignore buttons
* MB\_RETRYCANCEL - Display with retry and cancel buttons
* MB\_YESNO - Display with yes and no buttons
* MB\_YESNOCANCEL - Display with yes, no, cancel buttons
* MB\_ICONEXCLAMATION - Display with exclamation icon
* MB\_ICONINFORMATION - Display with information icon
* MB\_ICONQUESTION - Display with question mark icon
* MB\_ICONSTOP - Display with stop icon
* MB\_USERICON - Display with installer’s icon
* MB\_TOPMOST - Make messagebox topmost
* MB\_SETFOREGROUND - Set foreground
* MB\_RIGHT - Right align text
* MB\_RTLREADING - RTL reading order
* MB\_DEFBUTTON1 - Button 1 is default
* MB\_DEFBUTTON2 - Button 2 is default
* MB\_DEFBUTTON3 - Button 3 is default
* MB\_DEFBUTTON4 - Button 4 is default

Return\_check can be 0 (or empty, or left off), or one of the following:

* IDABORT - Abort button
* IDCANCEL - Cancel button
* IDIGNORE - Ignore button
* IDNO - No button
* IDOK - OK button
* IDRETRY - Retry button
* IDYES - Yes button

If the return value of the `MessageBox` is return\_check, the installer will [`Goto`](Goto.md) jumpto. Use the `/SD` parameter with one of the return\_check values above to specify the option that will be used when the installer is silent. See section [4.12](http://nsis.sourceforge.net/Docs//Chapter4.html#4.12) for more information.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
mb_option_list messagebox_text [/SD return] [return_check jumpto] [return_check_2 jumpto_2]
```

## Example

[Section titled “Example”](#example)

```plaintext
MessageBox MB_OK "simple message box"
MessageBox MB_YESNO "is it true?" IDYES true IDNO false
true:
  DetailPrint "it's true!"
  Goto next
false:
  DetailPrint "it's false"
next:
MessageBox MB_YESNO "is it true? (defaults to yes on silent installations)" /SD IDYES IDNO false2
  DetailPrint "it's true (or silent)!"
  Goto next2
false2:
  DetailPrint "it's false"
next2:
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# MiscButtonText

> Replaces the default text strings for the four buttons (< Back, Next >, Cancel and Close). If parameters are omitted, the defaults are used. Accepts variables.…

Replaces the default text strings for the four buttons (< Back, Next >, Cancel and Close). If parameters are omitted, the defaults are used. Accepts variables. If variables are used, they must be initialized in [`.onInit`](../Callbacks/onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[back_button_text [next_button_text] [cancel_button_text] [close_button_text]]
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# Name

> Sets the name of the installer. The name is usually simply the product name such as 'MyApp' or 'CrapSoft MyApp'. If you have one or more ampersands (&) in the…

Sets the name of the installer. The name is usually simply the product name such as ‘MyApp’ or ‘CrapSoft MyApp’. If you have one or more ampersands (&) in the name, set the second parameter to the same name, only with doubled ampersands.

Accepts variables. If variables are used, they must be initialized in [`.onInit`](../Callbacks/onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
name [name_doubled_ampersands]
```

## Example

[Section titled “Example”](#example)

```plaintext
Name "Foobar"
```

If your product’s name is “Foo & Bar”, use:

```plaintext
Name "Foo & Bar" "Foo && Bar"
```

If you have ampersands in the name and use a [`LangString`](LangString.md) for the name, you will have to create another one with doubled ampersands to use as the second parameter.

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# Nop

> Does nothing.

Does nothing.

## History

[Section titled “History”](#history)

Added in NSIS v1.1n

# OutFile

> Specifies the output file that the MakeNSIS should write the installer to. This is just the file that MakeNSIS writes, it doesn't affect the contents of the…

Specifies the output file that the MakeNSIS should write the installer to. This is just the file that MakeNSIS writes, it doesn’t affect the contents of the installer.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[path\]install.exe
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !packhdr

> This option makes the compiler use an external EXE packer (such as Petite or UPX) to compress the executable header. Specify a temporary file name (such as…

This option makes the compiler use an external EXE packer (such as [Petite](http://www.un4seen.com/petite/) or [UPX](http://upx.sourceforge.net/)) to compress the executable header. Specify a temporary file name (such as “temp.dat”) and a command line (such as “C:\program files\upx\upx -9 temp.dat”) to compress the header.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
tempfile command
```

## Example

[Section titled “Example”](#example)

```plaintext
!packhdr "$%TEMP%\exehead.tmp" '"C:\Program Files\UPX\upx.exe" "$%TEMP%\exehead.tmp"'
```

## History

[Section titled “History”](#history)

Added in NSIS v1.32

# Page

> Adds an installer page. See the above sections for more information about built-in versus custom pages and about callback functions.

Adds an installer page. See the above sections for more information about built-in versus custom pages and about callback functions.

internal\_page\_type can be:

* license - license page
* components - components selection page
* directory - installation directory selection page
* instfiles - installation page where the sections are executed
* uninstConfirm - uninstall confirmation page

The last page of the installer has its cancel button disabled to prevent confusion. To enable it anyway, use `/ENABLECANCEL`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
custom [creator_function] [leave_function] [caption] [/ENABLECANCEL]


internal_page_type [pre_function] [show_function] [leave_function] [/ENABLECANCEL]
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 0

# PageCallbacks

> Sets the callback functions for a page defined using PageEx. Can only be used inside a PageEx block. See the above sections for more information about callback…

Sets the callback functions for a page defined using [`PageEx`](PageEx.md). Can only be used inside a [`PageEx`](PageEx.md) block. See the above sections for more information about callback functions.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])
```

## Example

[Section titled “Example”](#example)

```plaintext
PageEx license
    PageCallbacks licensePre licenseShow licenseLeave
PageExEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 0

# PageEx

> Adds an installer page or an uninstaller page if the un. prefix was used. Every PageEx must have a matching PageExEnd. In a PageEx block you can set options…

Adds an installer page or an uninstaller page if the un. prefix was used. Every `PageEx` must have a matching [`PageExEnd`](PageExEnd.md). In a `PageEx` block you can set options that are specific to this page and will not be used for other pages. Options that are not set will revert to what was set outside the `PageEx` block or the default if nothing was set. To set the sub-caption for a page use [`Caption`](Caption.md) or [`SubCaption`](SubCaption.md) to set the default. To set the callback functions for a page set with `PageEx` use [`PageCallbacks`](PageCallbacks.md). See the above sections for more information about built-in versus custom pages.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[un.](custom|uninstConfirm|license|components|directory|instfiles)
```

## Example

[Section titled “Example”](#example)

```plaintext
PageEx license
    LicenseText "Readme"
    LicenseData readme.rtf
PageExEnd


PageEx license
    LicenseData license.txt
    LicenseForceSelection checkbox
PageExEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# PageEx

> Ends a PageEx block.

Ends a [`PageEx`](PageEx.md) block.

## Example

[Section titled “Example”](#example)

```plaintext
PageEx license
    LicenseText "Readme"
    LicenseData readme.rtf
PageExEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# PEAddResource

> Adds file as a resource to the installer and uninstaller. restype specifies the resource type and can be any string or # followed by a standard type or number.…

Adds `file` as a resource to the installer and uninstaller. `restype` specifies the resource type and can be any string or # followed by a standard type or number. `resname` must be # followed by a number. `reslang` is optional and specifies the language id of the resource. Replacing standard NSIS resources is not supported, you should use [`Icon`](Icon.md) and [`ChangeUI`](ChangeUI.md) instead.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/OVERWRITE|/REPLACE] file restype resname [reslang]
```

## Example

[Section titled “Example”](#example)

```plaintext
PEAddResource 0x020 0
```

## History

[Section titled “History”](#history)

Added in NSIS v3.05

# PEDllCharacteristics

> This command has not yet been officially documented

*This command has not yet been officially documented*

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
addbits removebits
```

## Example

[Section titled “Example”](#example)

```plaintext
PEDllCharacteristics 0x020 0
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0 Beta 1

# PERemoveResource

> Removes a resource added with PEAddResource.

Removes a resource added with [`PEAddResource`](PEAddResource.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/NOERRORS] restype resname reslang|ALL
```

## Example

[Section titled “Example”](#example)

```plaintext
PERemoveResource "#Icon" "#200" ALL
```

## History

[Section titled “History”](#history)

Added in NSIS v3.05

# PESubsysVer

> This command has not yet been officially documented

*This command has not yet been officially documented*

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
major.minor
```

## Example

[Section titled “Example”](#example)

```plaintext
PESubsysVer 1.2
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0 Beta 2

# Pop

> Pops a string off of the stack into user variable $var. If the stack is empty, the error flag will be set.

Pops a string off of the stack into user variable `$var`. If the stack is empty, the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(out)
```

## Example

[Section titled “Example”](#example)

```plaintext
Push 1
Pop $0 # = 1
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# !pragma

> The pragma commands allows you to change compiler features and behavior.

The pragma commands allows you to change compiler features and behavior.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
/REGEDIT5 root_key subkey key_name value
```

## Example

[Section titled “Example”](#example)

```plaintext
!pragma warning disable 9000 ; Disable warning about using "Setup.exe" as the name
OutFile "Setup.exe"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.02

# Push

> Pushes a string onto the stack. The string can then be popped off of the stack using the Pop command.

Pushes a string onto the stack. The string can then be popped off of the stack using the [`Pop`](Pop.md) command.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
string
```

## Example

[Section titled “Example”](#example)

```plaintext
Push "a string"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# Quit

> Causes the installer to exit as soon as possible. After Quit is called, the installer will exit (no callback functions will get a chance to run).

Causes the installer to exit as soon as possible. After `Quit` is called, the installer will exit (no callback functions will get a chance to run).

## History

[Section titled “History”](#history)

Added in NSIS v1.90b2

# ReadEnvStr

> Reads from the environment string "name" and sets the value into the user variable $x. If there is an error reading the string, the user variable is set to…

Reads from the environment string “name” and sets the value into the user variable $x. If there is an error reading the string, the user variable is set to empty, and the error flag is set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) name
```

## Example

[Section titled “Example”](#example)

```plaintext
ReadEnvStr $0 WINDIR
ReadEnvStr $1 TEMP
```

## History

[Section titled “History”](#history)

Added in NSIS v1.58

# ReadINIStr

> Reads from entry_name in [section_name] of ini_filename and stores the value into user variable $x. The error flag will be set and $x will be assigned to an…

Reads from entry\_name in \[section\_name] of ini\_filename and stores the value into user variable $x. The error flag will be set and $x will be assigned to an empty string if the entry is not found.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) ini_filename section_name entry_name
```

## Example

[Section titled “Example”](#example)

```plaintext
ReadINIStr $0 $INSTDIR\winamp.ini winamp outname
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# ReadRegDWORD

> Reads a 32 bit DWORD from the registry into the user variable $x. Valid values for root_key are listed under WriteRegStr. The error flag will be set and $x will…

Reads a 32 bit DWORD from the registry into the user variable $x. Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). The error flag will be set and $x will be set to an empty string ("" which is 0) if the DWORD is not present. If the value is present, but is not a DWORD, it will be read as a string and the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) root_key sub_key name
```

## Example

[Section titled “Example”](#example)

```plaintext
ReadRegDWORD $0 HKLM Software\NSIS VersionBuild
```

## History

[Section titled “History”](#history)

Added in NSIS v1.50

# ReadRegStr

> Reads from the registry into the user variable $x. Valid values for root_key are listed under WriteRegStr. The error flag will be set and $x will be set to an…

Reads from the registry into the user variable $x. Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). The error flag will be set and $x will be set to an empty string ("") if the string is not present. If the value is present, but is of type REG\_DWORD, it will be read and converted to a string and the error flag will be set.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) root_key sub_key name
```

## Example

[Section titled “Example”](#example)

```plaintext
ReadRegStr $0 HKLM Software\NSIS ""
DetailPrint "NSIS is installed at: $0"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# Reboot

> Reboots the computer. Be careful with this one. If it fails, .onRebootFailed is called. In any case, this instruction never returns, just like Quit.

Reboots the computer. Be careful with this one. If it fails, [`.onRebootFailed`](../Callbacks/onRebootFailed.md) is called. In any case, this instruction never returns, just like [`Quit`](Quit.md).

## Example

[Section titled “Example”](#example)

```plaintext
MessageBox MB_YESNO|MB_ICONQUESTION "Do you wish to reboot the system?" IDNO +2
Reboot
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# ReadRegStr

> Loads the specified DLL and calls DllRegisterServer (or entrypoint_name if specified). The error flag is set if an error occurs (i.e. it can't load the DLL,…

Loads the specified DLL and calls DllRegisterServer (or entrypoint\_name if specified). The error flag is set if an error occurs (i.e. it can’t load the DLL, initialize OLE, find the entry point, or the function returned anything other than ERROR\_SUCCESS (=0)).

Use [`SetOutPath`](SetOutPath.md) to set the current directory for DLLs that depend on other DLLs that are now in the path or in the Windows directory

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
dllfile [entrypoint_name]
```

## Example

[Section titled “Example”](#example)

If foo.dll depends on bar.dll which is located in $INSTDIR use:

```plaintext
SetOutPath $INSTDIR
RegDLL $INSTDIR\foo.dll
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# Rename

> Rename source_file to dest_file. You can use it to move a file from anywhere on the system to anywhere else and you can move a directory to somewhere else on…

Rename source\_file to dest\_file. You can use it to move a file from anywhere on the system to anywhere else and you can move a directory to somewhere else on the same drive. The destination file must not exist or the move will fail (unless you are using `/REBOOTOK`). If `/REBOOTOK` is specified, and the file cannot be moved (if, for example, the destination exists), then the file is moved when the system reboots. If the file will be moved on a reboot, the reboot flag will be set. The error flag is set if the file cannot be renamed (and `/REBOOTOK` is not used) or if the source file does not exist.

If no absolute path is specified the current folder will be used. The current folder is the folder set using the last [`SetOutPath`](SetOutPath.md) instruction. If you have not used [`SetOutPath`](SetOutPath.md) the current folder is [`$EXEDIR`](SetOutPath.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/REBOOTOK] source_file dest_file
```

## Example

[Section titled “Example”](#example)

```plaintext
Rename $INSTDIR\file.ext $INSTDIR\file.dat
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2

# RequestExecutionLevel

> Specifies the requested execution level for Windows Vista and Windows 7. The value is embedded in the installer and uninstaller's XML manifest and tells…

Specifies the requested execution level for Windows Vista and Windows 7. The value is embedded in the installer and uninstaller’s XML manifest and tells Vista/7, and probably future versions of Windows, what privileges level the installer requires. *user* requests a normal user’s level with no administrative privileges. *highest* will request the highest execution level available for the current user and will cause Windows to prompt the user to verify privilege escalation. The prompt might request for the user’s password. *admin* requests administrator level and will cause Windows to prompt the user as well. Specifying none, which is also the default, will keep the manifest empty and let Windows decide which execution level is required. Windows Vista/7 automatically identifies NSIS installers and decides administrator privileges are required. Because of this, none and admin have virtually the same effect.

It’s recommended that every application is marked with a required execution level. Unmarked installers are subject to compatibility mode. Workarounds of this mode include automatically moving any shortcuts created in the user’s start menu to all users’ start menu. Installers that don’t install anything into system folders nor write to the local machine registry (HKLM) should specify \e{user} execution level.

More information about this topic can be found at [MSDN](http://msdn.microsoft.com/en-us/library/bb756929). Keywords include “UAC”, “requested execution level”, “vista manifest” and “vista security”.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
none|user|highest|admin
```

## History

[Section titled “History”](#history)

Added in NSIS v2.21

# ReserveFile

> Reserves a file in the data block for later use. Files are added to the compressed data block in the order they appear in the script. Functions, however, are…

Reserves a file in the data block for later use. Files are added to the compressed data block in the order they appear in the script. Functions, however, are not necessarily called in the order they appear in the script. Therefore, if you add a file in a function called early but put the function at the end of the script, all of the files added earlier will have to be decompressed to get to the required file. This process can take a long time if there a lot of files. [`.onInit`](../Callbacks/onInit.md) is one such function. It is called at the very beginning, before anything else appears. If you put it at the very end of the script, extract some files in it and have lots of files added before it, the installer might take a very long time to load. This is where this command comes useful, allowing you to speed up the loading process by including the file at the top of the data block instead of letting NSIS seek all the way down to the bottom of the compressed data block.

See [`File`](File.md) for more information about the parameters.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/nonfatal] [/r] [/x file|wildcard [...]] file [file...]
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 0

# Rename

> Returns from a Function or Section.

Returns from a [`Function`](Function.md) or [`Section`](Section.md).

## Example

[Section titled “Example”](#example)

```plaintext
Function func
    StrCmp $0 "return now" 0 +2
    Return
    # do stuff
FunctionEnd


Section
    Call func
    ;"Return" will return here
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# RMDir

> Remove the specified directory (fully qualified path with no wildcards). Without /r, the directory will only be removed if it is completely empty. If /r is…

Remove the specified directory (fully qualified path with no wildcards). Without `/r`, the directory will only be removed if it is completely empty. If `/r` is specified, the directory will be removed recursively, so all directories and files in the specified directory will be removed. If `/REBOOTOK` is specified, any file or directory which could not have been removed during the process will be removed on reboot — if any file or directory will be removed on a reboot, the reboot flag will be set. The error flag is set if any file or directory cannot be removed.

**Warning:** using RMDir /r $INSTDIR in the uninstaller is not safe. Though it is unlikely, the user might select to install to the Program Files folder and so this command will wipe out the entire Program Files folder, including other programs that has nothing to do with the uninstaller. The user can also put other files but the program’s files and would expect them to get deleted with the program. Solutions are [available](http://nsis.sourceforge.net/Uninstall_only_installed_files) for easily uninstalling only files which were installed by the installer.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/r] [/REBOOTOK] directory_name
```

## Example

[Section titled “Example”](#example)

```plaintext
RMDir $INSTDIR
RMDir $INSTDIR\data
RMDir /r /REBOOTOK $INSTDIR
RMDir /REBOOTOK $INSTDIR\DLLs
```

Note that the current working directory can not be deleted. The current working directory is set by [`SetOutPath`](SetOutPath.md). For example, the following example will not delete the directory.

```plaintext
SetOutPath $TEMP\dir
RMDir $TEMP\dir
```

The next example will succeed in deleting the directory.

```plaintext
SetOutPath $TEMP\dir
SetOutPath $TEMP
RMDir $TEMP\dir
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !searchparse

> Parses source_string_or_file (which is treated as a string, or as a filename if /file is set), looking for substring_start. If substring_start is found, then…

Parses source\_string\_or\_file (which is treated as a string, or as a filename if `/file` is set), looking for substring\_start. If substring\_start is found, then OUTPUTSYMBOL1 is defined to the rest of the string (minus any other substring that may be found). Any number of OUTPUTSYMBOLx may be specified, and the final substring is optional. If `/noerrors` is specified, matching less than the full number of strings is allowed (all OUTPUTSYMBOLx after the not-found substring will be ignored). If `/file` is specified, the file is treated as a series of lines. The file is searched until all substrings are matched. If `/noerrors` is specified and not all strings are matched, the first line with the most symbols matched is used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/ignorecase] [/noerrors] [/file] source_string_or_file substring_start OUTPUTSYMBOL1 [substring [OUTPUTSYMBOL2 [substring ...]]]
```

## Example

[Section titled “Example”](#example)

```plaintext
# search filename.cpp for a line '#define APP_VERSION "2.5"' and set ${VER_MAJOR} to 2, ${VER_MINOR} to 5.
!searchparse /file filename.cpp `#define APP_VERSION "` VER_MAJOR `.` VER_MINOR `"`
```

## History

[Section titled “History”](#history)

Added in NSIS v2.39

# SearchPath

> Assign to the user variable $x, the full path of the file named by the second parameter. The error flag will be set and $x will be empty if the file cannot be…

Assign to the user variable $x, the full path of the file named by the second parameter. The error flag will be set and $x will be empty if the file cannot be found. Uses SearchPath() to search the system paths for the file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(output) filename
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# !searchreplace

> Searches source_string, looking for searchfor and replacing all instances of it with replacewith. Unlike !define, !searchreplace allows you to redefine…

Searches source\_string, looking for searchfor and replacing all instances of it with replacewith. Unlike [`!define`](!define.md), `!searchreplace` allows you to redefine symbol\_out without warning or error.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/ignorecase] symbol_out source_string searchfor replacewith
```

## Example

[Section titled “Example”](#example)

```plaintext
# defines ${blah} to "i like ponies"
!searchreplace blah "i love ponies" "love" "like"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.42

# Section

> Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of…

Begins and opens a new section. If section\_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is ‘Uninstall’ or is prefixed with ‘un.’, then it is a an uninstaller section. If section\_index\_output is specified, the parameter will be [`!define`](!define.md)d with the section index (that can be used for [`SectionSetText`](SectionSetText.md) etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/o] [([!]|[-])section_name] [section_index_output]
```

## Example

[Section titled “Example”](#example)

```plaintext
Section "-hidden section"
SectionEnd


Section # hidden section
SectionEnd


Section "!bold section"
SectionEnd


Section /o "optional"
SectionEnd


Section "install something" SEC_IDX
SectionEnd
```

To access the section index, curly brackets must be used and the code must be located below the section in the script.

```plaintext
Section test1 sec1_id
SectionEnd


Section test2 sec2_id
SectionEnd


Function .onInit
    SectionGetText ${sec2_id} $0
    MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will correctly display 'name of 1: test2'
FunctionEnd


Function .onInit
    SectionGetText ${sec2_id} $0
    MessageBox MB_OK "name of ${sec2_id}:$\n$0" # will incorrectly display 'name of ${sec2_id}: test1'
    # plus a warning stating:
    #   unknown variable/constant "{sec2_id}" detected, ignoring
FunctionEnd


Section test1 sec1_id
SectionEnd


Section test2 sec2_id
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SectionEnd

> This command closes the current open Section.

This command closes the current open [`Section`](Section.md).

## Example

[Section titled “Example”](#example)

```plaintext
Section "install something" SEC_IDX
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.3

# SectionGetFlags

> Retrieves the section's flags. See above for a description of the flag. The error flag will be set if an out of range section is specified.

Retrieves the section’s flags. See above for a description of the flag. The error flag will be set if an out of range section is specified.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
Section test test_section_id
SectionEnd


Function .onSelChange
    # keep section 'test' selected
    SectionGetFlags ${test_section_id} $0
    IntOp $0 $0 | ${SF_SELECTED}
    SectionSetFlags ${test_section_id} $0
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# SectionGetInstTypes

> Retrieves the install types flags array of a section. See the explanation about SectionSetInstTypes for a description of how to deal with the output. The error…

Retrieves the install types flags array of a section. See the explanation about [`SectionSetInstTypes`](SectionSetInstTypes.md) for a description of how to deal with the output. The error flag will be set if the section index specified is out of range.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
Section test test_section_id
SectionEnd


Function .onInit
    # associate section 'test' with installation types 5, on top of its existing associations
    SectionGetInstTypes ${test_section_id} $0
    IntOp $0 $0 | 16
    SectionSetInstTypes ${test_section_id} $0
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 3

# SectionGetSize

> Gets the Size of the section specified by section_index and stores the value in the given User Variable. Note that the Index starts with Zero.

Gets the Size of the section specified by section\_index and stores the value in the given User Variable. Note that the Index starts with Zero.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index user_var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section test test_section_id
SectionEnd


Function .onInit
    # increase required size of section 'test' by 100 bytes
    SectionGetSize ${test_section_id} $0
    IntOp $0 $0 + 100
    SectionSetSize ${test_section_id} $0
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# SectionGetText

> Stores the text description of the section section_index into the output. If the section is hidden, stores an empty string. The error flag will be set if an out…

Stores the text description of the section section\_index into the output. If the section is hidden, stores an empty string. The error flag will be set if an out of range section is specified.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index user_var(output)
```

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInit
    # append $WINDIR to section's name
    SectionGetText ${test_section_id} $0
    StrCpy $0 "$0 - $WINDIR"
    SectionSetText ${test_section_id} $0
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# SectionGroup

> This command inserts a section group. The section group must be closed with SectionGroupEnd, and should contain 1 or more sections. If the section group name…

This command inserts a section group. The section group must be closed with [`SectionGroupEnd`](SectionGroupEnd.md), and should contain 1 or more sections. If the section group name begins with a !, its name will be displayed with a bold font. If `/e` is present, the section group will be expanded by default. If index\_output is specified, the parameter will be [`!define`](!define.md)d with the section index (that can be used for [`SectionSetText`](SectionSetText.md) etc). If the name is prefixed with ‘un.’ the section group is an uninstaller section group.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/e] section_group_name [index_output]
```

## Example

[Section titled “Example”](#example)

```plaintext
SectionGroup "some stuff"
    Section "a section"
    SectionEnd


    Section "another section"
    SectionEnd
SectionGroupEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.05

# SectionGroupEnd

> Closes a section group opened with SectionGroup.

Closes a section group opened with [`SectionGroup`](SectionGroup.md).

## Example

[Section titled “Example”](#example)

```plaintext
SectionGroup "some stuff"
    Section "a section"
    SectionEnd


    Section "another section"
    SectionEnd
SectionGroupEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.05

# SectionIn

> This command specifies which install types (see InstType) the current section defaults to the enabled state in. Multiple SectionIn commands can be specified…

This command specifies which install types (see [`InstType`](InstType.md)) the current section defaults to the enabled state in. Multiple `SectionIn` commands can be specified (they are combined). If you specify `$RO` as a parameter, then the section will be read-only, meaning the user won’t be able to change its state. The first install type defined using [\`InstType’](InstType.md) is indexed 1, the next 2 and so on.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
insttype_index [insttype_index] [RO]
```

## Example

[Section titled “Example”](#example)

```plaintext
InstType "full"
InstType "minimal"


Section "a section"
    SectionIn 1 2
SectionEnd


Section "another section"
    SectionIn 1
SectionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SectionSetFlags

> Sets the section's flags. The flag is a 32 bit integer. The first bit (lowest) represents whether the section is currently selected, the second bit represents…

Sets the section’s flags. The flag is a 32 bit integer. The first bit (lowest) represents whether the section is currently selected, the second bit represents whether the section is a section group (don’t modify this unless you really know what you are doing), the third bit represents whether the section is a section group end (again, don’t modify), the fourth bit represents whether the section is shown in bold or not, the fifth bit represents whether the section is read-only, the sixth bit represents whether the section group is to be automatically expanded, the seventh bit is set for section groups which are partially selected, the eighth bit is internally used for partially selected section group toggling and the ninth bit is used for reflecting section name changes. The error flag will be set if an out of range section is specified.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index section_flags
```

## Example

[Section titled “Example”](#example)

Each flag has a name, prefixed with `SF_`:

```plaintext
!define SF_SELECTED   1
!define SF_SECGRP     2
!define SF_SECGRPEND  4
!define SF_BOLD       8
!define SF_RO         16
!define SF_EXPAND     32
!define SF_PSELECTED  64
```

For an example of usage please see the [one-section.nsi](http://nsis.sourceforge.net/Docs/Examples/one-section.nsi) example.

For more useful macros and definitions, see Include\Sections.nsh.

```plaintext
Section test test_section_id
SectionEnd


Function .onInit
  # set section 'test' as selected and read-only
  IntOp $0 ${SF_SELECTED} | ${SF_RO}
  SectionSetFlags ${test_section_id} $0
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# SectionSetInstTypes

> Sets the install types the section specified by section_index defaults to the enabled state in. Note that the section index starts with zero. Every bit of…

Sets the install types the section specified by section\_index defaults to the enabled state in. Note that the section index starts with zero. Every bit of inst\_types is a flag that tells if the section is in that install type or not. For example, if you have 3 install types and you want the first section to be included in install types 1 and 3, then the command should look like this:

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index inst_types
```

## Example

[Section titled “Example”](#example)

```plaintext
SectionSetInstTypes 0 5
# because the binary value for 5 is "00000101". The error flag will be set if the section index specified is out of range.


Section test test_section_id
SectionEnd


Function .onInit
    # associate section 'test' with installation types 3 and 4
    SectionSetInstTypes ${test_section_id} 12
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 3

# SectionSetSize

> Sets the Size of the section specified by section_index. Note that the Index starts with Zero. The Value for Size must be entered in KiloByte and supports only…

Sets the Size of the section specified by section\_index. Note that the Index starts with Zero. The Value for Size must be entered in KiloByte and supports only whole numbers.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index new_size
```

## Example

[Section titled “Example”](#example)

```plaintext
Section test test_section_id
SectionEnd


Function .onInit
    # set required size of section 'test' to 100 bytes
    SectionSetSize ${test_section_id} 100
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# SectionSetText

> Sets the description for the section section_index. If the text is set to "" then the section will be hidden. The error flag will be set if an out of range…

Sets the description for the section section\_index. If the text is set to "" then the section will be hidden. The error flag will be set if an out of range section is specified.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
section_index section_text
```

## Example

[Section titled “Example”](#example)

```plaintext
Section "" test_section_id
SectionEnd


Function .onInit
    # change section's name to $WINDIR
    SectionSetText ${test_section_id} $WINDIR
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# SendMessage

> Sends a message to HWND. If a user variable $x is specified as the last parameter (or one before the last if you use /TIMEOUT), the return value of SendMessage…

Sends a message to HWND. If a user variable $x is specified as the last parameter (or one before the last if you use `/TIMEOUT`), the return value of `SendMessage` will be stored to it. Note that when specifying ‘msg’ you must just use the integer value of the message. If you wish to send strings use “STR:a string” as wParam or lParam where needed.

WM\_CLOSE 16 WM\_COMMAND 273 WM\_USER 1024

Include WinMessages.nsh to have all of Windows messages defined in your script.

To send a string param, put STR: before the parameter, for example: “STR:Some string”.

Use /TIMEOUT=time\_in\_ms to specify the duration, in milliseconds, of the time-out period.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
HWND msg wparam lparam [user_var(return value)] [/TIMEOUT=time_in_ms]
```

## Example

[Section titled “Example”](#example)

```plaintext
!include WinMessages.nsh
FindWindow $0 "Winamp v1.x"
SendMessage $0 ${WM_CLOSE} 0 0
```

## History

[Section titled “History”](#history)

Added in NSIS v1.51

# SetAutoClose

> Overrides the default auto window-closing flag (specified for the installer using AutoCloseWindow, and false for the uninstaller). Specify 'true' to have the…

Overrides the default auto window-closing flag (specified for the installer using [`AutoCloseWindow`](AutoCloseWindow.md), and false for the uninstaller). Specify ‘true’ to have the install window immediately disappear after the install has completed, or ‘false’ to make it require a manual close.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v1.42

# SetBrandingImage

> Sets the current bitmap file displayed as the branding image. If no IMGID is specified, the first image control found will be used, or the image control created…

Sets the current bitmap file displayed as the branding image. If no IMGID is specified, the first image control found will be used, or the image control created by [`AddBrandingImage`](AddBrandingImage.md). Note that this bitmap must be present on the user’s machine. Use [`File`](File.md) first to put it there. If `/RESIZETOFIT` is specified the image will be automatically resized (very poorly) to the image control size. If you used [`AddBrandingImage`](AddBrandingImage.md) you can get this size, by compiling your script and watching for [`AddBrandingImage`](AddBrandingImage.md) output, it will tell you the size. `SetBrandingImage` will not work when called from [`.onInit`](../Callbacks/onInit.md)!

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/IMGID=item_id_in_dialog] [/RESIZETOFIT] path_to_bitmap_file.bmp
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# SetCompress

> This command sets the compress flag which is used by the installer to determine whether or not data should be compressed. Typically the SetCompress flag will…

This command sets the compress flag which is used by the installer to determine whether or not data should be compressed. Typically the `SetCompress` flag will affect the commands after it, and the last `SetCompress` command in the file also determines whether or not the install info section and uninstall data of the installer is compressed. If compressflag is ‘auto’, then files are compressed if the compressed size is smaller than the uncompressed size. If compressflag is set to ‘force’, then the compressed version is always used. If compressflag is ‘off’ then compression is not used (which can be faster).

Note that this option has no effect when solid compression is used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
auto|force|off
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SetCompressor

> This command sets the compression algorithm used to compress files/data in the installer. It can only be used outside of sections and functions and before any…

This command sets the compression algorithm used to compress files/data in the installer. It can only be used outside of sections and functions and before any data is compressed. Different compression methods can not be used for different files in the same installer. It is recommended to use it on the very top of the script to avoid compilation errors.

Three compression methods are supported: ZLIB, BZIP2 and LZMA.

ZLIB (the default) uses the deflate algorithm, it is a quick and simple method. With the default compression level it uses about 300 KB of memory.

BZIP2 usually gives better compression ratios than ZLIB, but it is a bit slower and uses more memory. With the default compression level it uses about 4 MB of memory.

LZMA is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.

If `/FINAL` is used, subsequent calls to SetCompressor will be ignored.

If `/SOLID` is used, all of the installer data is compressed in one block. This results in greater compression ratios.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/SOLID] [/FINAL] zlib|bzip2|lzma
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# SetCompressorDictSize

> Sets the dictionary size in megabytes (MB) used by the LZMA compressor (default is 8 MB).

Sets the dictionary size in megabytes (MB) used by the LZMA compressor (default is 8 MB).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
dict_size_mb
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# SetCtlColors

> Sets a background color and the text color for a static control, edit control, button or a dialog. text_color and bg_color don't accept variables. Use…

Sets a background color and the text color for a static control, edit control, button or a dialog. text\_color and bg\_color don’t accept variables. Use [`GetDlgItem`](GetDlgItem.md) to get the handle (HWND) of the control. To make the control transparent specify “transparent” as the background color value. You can also specify `/BRANDING` with or without text color and background color to make the control completely gray (or any other color you choose). This is used by the branding text control in the MUI.

Warning: setting the background color of check boxes to “transparent” may not function properly when using [`XPStyle`](XPStyle.md) on. The background may be completely black, instead of transparent, when using certain Windows themes.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
hwnd [/BRANDING] [text_color] [transparent|bg_color]
```

## Example

[Section titled “Example”](#example)

```plaintext
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1006
SetCtlColors $0 0xFF0000 0x00FF00
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 2

# SetCurInstType

> Sets the current InstType. inst_type_idx should be between 0 and 31. The Error Flag is not set if an out of range InstType was used.

Sets the current [`InstType`](InstType.md). inst\_type\_idx should be between 0 and 31. The Error Flag is not set if an out of range [`InstType`](InstType.md) was used.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
inst_type_idx
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# SetDatablockOptimize

> This command tells the compiler whether or not to do datablock optimizations. Datablock optimizations have the compiler check to see if any data being added to…

This command tells the compiler whether or not to do datablock optimizations. Datablock optimizations have the compiler check to see if any data being added to the data block is already in the data block, and if so, it is simply referenced as opposed to added (can save a little bit of size). It is highly recommended to leave this option on.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1i

# SetDateSave

> This command sets the file date/time saving flag which is used by the File command to determine whether or not to save the last write date and time of the file,…

This command sets the file date/time saving flag which is used by the File command to determine whether or not to save the last write date and time of the file, so that it can be restored on installation. Valid flags are ‘on’ and ‘off’. ‘on’ is the default.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# SetDetailsPrint

> Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only…

Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on Windows 9x with smooth scrolling enabled).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
none|listonly|textonly|both|lastused
```

## Example

[Section titled “Example”](#example)

```plaintext
SetDetailsPrint none
File "secret file.dat"
SetDetailsPrint both
```

## History

[Section titled “History”](#history)

Added in NSIS v1.62

# SetDetailsView

> Shows or hides the details, depending on which parameter you pass. Overrides the default details view, which is set via ShowInstDetails.

Shows or hides the details, depending on which parameter you pass. Overrides the default details view, which is set via [`ShowInstDetails`](ShowInstDetails.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
show|hide
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1t

# SetErrorLevel

> Sets the error level of the installer or uninstaller to error_level. See Error Levels for more information.

Sets the error level of the installer or uninstaller to error\_level. See Error Levels for more information.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
error_level
```

## Example

[Section titled “Example”](#example)

```plaintext
IfRebootFlag 0 +2
SetErrorLevel 4
```

## History

[Section titled “History”](#history)

Added in NSIS v2.02

# SetErrors

> Sets the error flag.

Sets the error flag.

## Example

[Section titled “Example”](#example)

```plaintext
SetErrors
IfErrors 0 +2
MessageBox MB_OK "this message box will always show"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# SetFileAttributes

> Sets the file attributes of 'filename'. Valid attributes can be combined with | and are:

Sets the file attributes of ‘filename’. Valid attributes can be combined with | and are:

* NORMAL or FILE\_ATTRIBUTE\_NORMAL (you can use 0 to abbreviate this)
* ARCHIVE or FILE\_ATTRIBUTE\_ARCHIVE
* HIDDEN or FILE\_ATTRIBUTE\_HIDDEN
* OFFLINE or FILE\_ATTRIBUTE\_OFFLINE
* READONLY or FILE\_ATTRIBUTE\_READONLY
* SYSTEM or FILE\_ATTRIBUTE\_SYSTEM
* TEMPORARY or FILE\_ATTRIBUTE\_TEMPORARY

The error flag will be set if the file’s attributes cannot be set (i.e. the file doesn’t exist, or you don’t have the right permissions). You can only set attributes. It’s not possible to unset them. If you want to remove an attribute use NORMAL. This way all attributes are erased. This command doesn’t support wildcards.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
filename attribute1|attribute2|...
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2c

# SetFont

> Sets the installer font. Please remember that the font you choose must be present on the user's machine as well. Don't use rare fonts that only you have.

Sets the installer font. Please remember that the font you choose must be present on the user’s machine as well. Don’t use rare fonts that only you have.

Use the `/LANG` switch if you wish to set a different font for each language.

There are two LangStrings named ^Font and ^FontSize which contain the font and font size for every language.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/LANG=lang_id] font_face_name font_size
```

## Example

[Section titled “Example”](#example)

```plaintext
 SetFont /LANG=${LANG_ENGLISH} "English Font" 9
 SetFont /LANG=${LANG_FRENCH} "French Font" 10
```

## History

[Section titled “History”](#history)

Added in NSIS v1.3

# SetOutPath

> Sets the output path ($OUTDIR) and creates it (recursively if necessary), if it does not exist. Must be a full pathname, usually is just $INSTDIR (you can…

Sets the output path ([`$OUTDIR`](../Variables/OUTDIR.md)) and creates it (recursively if necessary), if it does not exist. Must be a full pathname, usually is just [`$INSTDIR`](../Variables/INSTDIR.md) (you can specify [`$INSTDIR`](../Variables/INSTDIR.md) if you are lazy with a single ”-”).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
outpath
```

## Example

[Section titled “Example”](#example)

```plaintext
SetOutPath $INSTDIR
File program.exe
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SetOverwrite

> This command sets the overwrite flag which is used by the File command to determine whether or not the file should overwrite any existing files that are…

This command sets the overwrite flag which is used by the [`File`](File.md) command to determine whether or not the file should overwrite any existing files that are present. If overwriteflag is ‘on’, files are overwritten (this is the default). If overwriteflag is ‘off’, files that are already present are not overwritten. If overwriteflag is ‘try’, files are overwritten if possible (meaning that if the file is not able to be written to, it is skipped without any user interaction). If overwriteflag is ‘ifnewer’, then files are only overwritten if the existing file is older than the new file. If overwriteflag is ‘ifdiff’, then files are only overwritten if the existing file is older or newer than the new file. Note that when in ‘ifnewer’ or ‘ifdiff’ mode, the destination file’s date is set, regardless of what [`SetDateSave`](SetDateSave.md) is set to.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off|try|ifnewer|ifdiff|lastused
```

## Example

[Section titled “Example”](#example)

```plaintext
SetOverwrite off
File program.cfg # config file we don't want to overwrite
SetOverwrite on
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SetRebootFlag

> Sets the reboot flag to either true or false. The flag's value can be read using IfRebootFlag.

Sets the reboot flag to either true or false. The flag’s value can be read using [`IfRebootFlag`](IfRebootFlag.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
true|false
```

## Example

[Section titled “Example”](#example)

```plaintext
SetRebootFlag true
IfRebootFlag 0 +2
MessageBox MB_OK "this message box will always show"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# SetRegView

> Sets the registry view affected by registry commands. On Windows x64 there are two views. One for 32-bit applications and one for x64 applications. By default,…

Sets the registry view affected by registry commands. On Windows x64 there are two views. One for 32-bit applications and one for x64 applications. By default, 32-bit applications running on x64 systems under WOW64 have access only to the 32-bit view. Using SetRegView 64 allows the installer to access keys in the x64 view of the registry.

Affects [`DeleteRegKey`](DeleteRegKey.md), [`DeleteRegValue`](DeleteRegValue.md), [`EnumRegKey`](EnumRegKey.md), [`EnumRegValue`](EnumRegValue.md), [`ReadRegDWORD`](ReadRegDWORD.md), [`ReadRegStr`](ReadRegStr.md), [`WriteRegBin`](WriteRegBin.md), [`WriteRegDWORD`](WriteRegDWORD.md), [`WriteRegStr`](WriteRegStr.md) and [`WriteRegExpandStr`](WriteRegExpandStr.md).

Does not affect [`InstallDirRegKey`](InstallDirRegKey.md). Instead, the registry can be read using [`ReadRegStr`](ReadRegStr.md) in [`.onInit`](../Callbacks/onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
32|64|lastused
```

## Example

[Section titled “Example”](#example)

```plaintext
SetRegView 32
ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion ProgramFilesDir
DetailPrint $0 # prints C:\Program Files (x86)
SetRegView 64
ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion ProgramFilesDir
DetailPrint $0 # prints C:\Program Files


Function .onInit
    SetRegView 64
    ReadRegStr $INSTDIR HKLM Software\NSIS ""
    SetRegView 32
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.26

# SetShellVarContext

> Sets the context of $SMPROGRAMS and other shell folders. If set to 'current' (the default), the current user's shell folders are used. If set to 'all', the 'all…

Sets the context of [`$SMPROGRAMS`](../Variables/SMPROGRAMS.md) and other shell folders. If set to ‘current’ (the default), the current user’s shell folders are used. If set to ‘all’, the ‘all users’ shell folder is used. The all users folder may not be supported on all OSes. If the all users folder is not found, the current user folder will be used. Please take into consideration that a “normal user” has no rights to write in the all users area. Only admins have full access rights to the all users area. You can check this by using the UserInfo plug-in. See Contrib\UserInfo\UserInfo.nsi for an example.

Note that, if used in installer code, this will only affect the installer, and if used in uninstaller code, this will only affect the uninstaller. To affect both, it needs to be used in both.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
current|all
```

## Example

[Section titled “Example”](#example)

```plaintext
SetShellVarContext current
StrCpy $0 $DESKTOP
SetShellVarContext all
StrCpy $1 $DESKTOP
MessageBox MB_OK $0$\n$1
```

## History

[Section titled “History”](#history)

Added in NSIS v1.98

# SetSilent

> Sets the installer to silent mode or normal mode. See SilentInstall for more information about silent installations. Can only be used in .onInit.

Sets the installer to silent mode or normal mode. See [`SilentInstall`](SilentInstall.md) for more information about silent installations. Can only be used in [`.onInit`](../Callbacks/onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
silent | normal
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# ShowInstDetails

> Sets whether or not the details of the install are shown. Can be 'hide' to hide the details by default, allowing the user to view them, or 'show' to show them…

Sets whether or not the details of the install are shown. Can be ‘hide’ to hide the details by default, allowing the user to view them, or ‘show’ to show them by default, or ‘nevershow’, to prevent the user from ever seeing them. Note that sections can override this using [`SetDetailsView`](SetDetailsView.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
hide|show|nevershow
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# ShowUninstDetails

> Sets whether or not the details of the uninstall are shown. Can be 'hide' to hide the details by default, allowing the user to view them, or 'show' to show them…

Sets whether or not the details of the uninstall are shown. Can be ‘hide’ to hide the details by default, allowing the user to view them, or ‘show’ to show them by default, or ‘nevershow’, to prevent the user from ever seeing them. Note that sections can override this using [`SetDetailsView`](SetDetailsView.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
hide|show|nevershow
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# ShowWindow

> Sets the visibility of a window. Possible show_states are the same as Windows ShowWindow function. SW_* constants are defined in Include\WinMessages.nsh.

Sets the visibility of a window. Possible show\_states are the same as [Windows ShowWindow](http://msdn2.microsoft.com/en-us/library/ms633548) function. SW\_\* constants are defined in [Include\WinMessages.nsh](http://nsis.sourceforge.net/Docs/Include/WinMessages.nsh).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
hwnd show_state
```

## Example

[Section titled “Example”](#example)

```plaintext
!include WinMessages.nsh
GetDlgItem $0 $HWNDPARENT 1
ShowWindow $0 ${SW_HIDE}
Sleep 1000
ShowWindow $0 ${SW_SHOW}
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# SilentInstall

> Specifies whether or not the installer should be silent. If it is 'silent' or 'silentlog', all sections that have the SF_SELECTED flag are installed quietly…

Specifies whether or not the installer should be silent. If it is ‘silent’ or ‘silentlog’, all sections that have the SF\_SELECTED flag are installed quietly (you can set this flag using [`SectionSetFlags`](SectionSetFlags.md)), with no screen output from the installer itself (the script can still display whatever it wants, use [`MessageBox`](MessageBox.md)’s `/SD` to specify a default for silent installers). Note that if this is set to ‘normal’ and the user runs the installer with `/S` (case sensitive) on the command line, it will behave as if `SilentInstall` ‘silent’ was used.

Note: see also [`LogSet`](LogSet.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
normal|silent|silentlog
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# SilentUnInstall

> Specifies whether or not the uninstaller should be silent. If it is 'silent' the uninstall sections will run quietly, with no screen output from the uninstaller…

Specifies whether or not the uninstaller should be silent. If it is ‘silent’ the uninstall sections will run quietly, with no screen output from the uninstaller itself (the script can still display whatever it wants, use [`MessageBox`](MessageBox.md)’s `/SD` to specify a default for silent uninstallers). Note that if this is set to ‘normal’ and the user runs the uninstaller with `/S` on the command line, it will behave as if \`SilentUnInstall ‘silent’ was used.

Note: see also [`LogSet`](LogSet.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
normal|silent
```

## History

[Section titled “History”](#history)

Added in NSIS v1.7b2

# Sleep

> Pauses execution in the installer for sleeptime_in_ms milliseconds. sleeptime_in_ms can be a variable, e.g. "$0" or a number, i.e. "666".

Pauses execution in the installer for `sleeptime_in_ms` milliseconds. `sleeptime_in_ms` can be a variable, e.g. “$0” or a number, i.e. “666”.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
sleeptime_in_ms
```

## Example

[Section titled “Example”](#example)

```plaintext
DetailPrint "sleeping..."
Sleep 3000
DetailPrint "back to work"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1a

# SpaceTexts

> If parameters are specified, overrides the space required and space available text ("Space required: " and "Space available: " by default). If 'none' is…

If parameters are specified, overrides the space required and space available text (“Space required: ” and “Space available: ” by default). If ‘none’ is specified as the required text no space texts will be shown.

Accepts variables. If variables are used, they must be initialized before the components page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[req_text [avail_text]]
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 0

# StrCmp

> Compares (case insensitively) str1 to str2. If str1 and str2 are equal, Goto jump_if_equal, otherwise Goto jump_if_not_equal.

Compares (case insensitively) str1 to str2. If str1 and str2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise [`Goto`](Goto.md) jump\_if\_not\_equal.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
str1 str2 jump_if_equal [jump_if_not_equal]
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCmp $0 "a string" 0 +3
DetailPrint '$$0 == "a string"'
Goto +2
DetailPrint '$$0 != "a string"'
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# StrCmpS

> Compares (case sensitively) str1 to str2. If str1 and str2 are equal, Goto jump_if_equal, otherwise Goto jump_if_not_equal.

Compares (case sensitively) str1 to str2. If str1 and str2 are equal, [`Goto`](Goto.md) jump\_if\_equal, otherwise [`Goto`](Goto.md) jump\_if\_not\_equal.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
str1 str2 jump_if_equal [jump_if_not_equal]
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCmp $0 "a string" 0 +3
DetailPrint '$$0 == "a string"'
Goto +2
DetailPrint '$$0 != "a string"'
```

## History

[Section titled “History”](#history)

Added in NSIS v2.13

# StrCpy

> Sets the user variable $x with str. Note that str can contain other variables, or the user variable being set (concatenating strings this way is possible, etc).…

Sets the user variable $x with str. Note that str can contain other variables, or the user variable being set (concatenating strings this way is possible, etc). If maxlen is specified, the string will be a maximum of maxlen characters (if maxlen is negative, the string will be truncated abs(maxlen) characters from the end). If start\_offset is specified, the source is offset by it (if start\_offset is negative, it will start abs(start\_offset) from the end of the string).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(destination) str [maxlen] [start_offset]
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 "a string" # = "a string"
StrCpy $0 "a string" 3 # = "a s"
StrCpy $0 "a string" -1 # = "a strin"
StrCpy $0 "a string" "" 2 # = "string"
StrCpy $0 "a string" "" -3 # = "ing"
StrCpy $0 "a string" 3 -4 # = "rin"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.2g

# StrLen

> Sets user variable $x with the length of str.

Sets user variable $x with the length of str.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(length output) str
```

## Example

[Section titled “Example”](#example)

```plaintext
StrLen $0 "123456" # = 6
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# SubCaption

> Overrides the subcaptions for each of the installer pages (0=": License Agreement",1=": Installation Options",2=": Installation Directory", 3=": Installing…

Overrides the subcaptions for each of the installer pages (0=”: License Agreement”,1=”: Installation Options”,2=”: Installation Directory”, 3=”: Installing Files”, 4=”: Completed”). If you specify an empty string (""), the default will be used (you can however specify ” ” to achieve a blank string).

You can also set a subcaption (or override the default) using [`Caption`](Caption.md) inside a [`PageEx`](PageEx.md) block.

Accepts variables. If variables are used, they must be initialized before the relevant page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[page_number subcaption]
```

## History

[Section titled “History”](#history)

Added in NSIS v1.56

# !system

> This command will execute 'command' using a call to system(), and if the return value compared (using 'compare') to 'comparevalue' is false, execution will…

This command will execute ‘command’ using a call to system(), and if the return value compared (using ‘compare’) to ‘comparevalue’ is false, execution will halt. ‘compare’ can be ’<’ or ’>’ or ’<>’ or ’=’.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command [compare comparevalue]
```

## Example

[Section titled “Example”](#example)

```plaintext
!system '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
!system 'echo !define something > newinclude.nsh'
!include newinclude.nsh
!ifdef something
    !echo "something is defined"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1d

# !tempfile

> This command creates a temporary file. It puts its path into a define, named symbol.

This command creates a temporary file. It puts its path into a define, named symbol.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
symbol
```

## Example

[Section titled “Example”](#example)

```plaintext
!tempfile PACKHDRTEMP
!packhdr "${PACKHDRTEMP}" '"C:\Program Files\UPX\upx.exe" "${PACKHDRTEMP}"'
!tempfile FILE
!define /date DATE "%H:%M:%S %d %b, %Y"
!system 'echo built on ${DATE} > "${FILE}"'
File /oname=build.txt "${FILE}"
!delfile "${FILE}"
!undef FILE
!undef DATE
```

## History

[Section titled “History”](#history)

Added in NSIS v2.11

# !undef

> Removes an item from the global define list. Note that ${SYMBOL} where SYMBOL is undefined will be translated to ${SYMBOL}.

Removes an item from the global define list. Note that `${SYMBOL}` where SYMBOL is undefined will be translated to `${SYMBOL}`.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
gflag
```

## Example

[Section titled “Example”](#example)

```plaintext
!define SOMETHING
!undef SOMETHING
```

## History

[Section titled “History”](#history)

Added in NSIS v1.51

# Unicode

> Generate a Unicode installer. It can only be used outside of sections and functions and before any data is compressed.

Generate a Unicode installer. It can only be used outside of sections and functions and before any data is compressed.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
true|false
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a

# UninstallButtonText

> Changes the text of the button that by default says "Uninstall" in the uninstaller. If no parameter is specified, the default text is used.

Changes the text of the button that by default says “Uninstall” in the uninstaller. If no parameter is specified, the default text is used.

Accepts variables. If variables are used, they must be initialized before the uninstall button shows.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
text
```

## History

[Section titled “History”](#history)

Added in NSIS v1.60

# UninstallCaption

> Sets what the titlebars of the uninstaller will display. By default it is '$(^Name) Uninstall', where Name is specified with the Name command. You can, however,…

Sets what the titlebars of the uninstaller will display. By default it is ’$(^Name) Uninstall’, where [`Name`](Name.md) is specified with the Name command. You can, however, override it with ‘MyApp uninstaller’ or whatever. If you specify an empty string (""), the default will be used (you can specify ” ” to simulate a empty string).

Accepts variables. If variables are used, they must be initialized in [`un.onInit`](../Callbacks/un.onInit.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
caption
```

## History

[Section titled “History”](#history)

Added in NSIS v1.56

# UninstallIcon

> Sets the icon of the uninstaller.

Sets the icon of the uninstaller.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[path\]icon.ico
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# UninstallSubCaption

> Sets the default subcaptions for the uninstaller pages (0=": Confirmation",1=": Uninstalling Files",2=": Completed"). If you specify an empty string (""), the…

Sets the default subcaptions for the uninstaller pages (0=”: Confirmation”,1=”: Uninstalling Files”,2=”: Completed”). If you specify an empty string (""), the default will be used (you can however specify ” ” to simulate an empty string).

You can also set a subcaption (or override the default) using [`Caption`](Caption.md) inside a [`PageEx`](PageEx.md) block.

Accepts variables. If variables are used, they must be initialized before the relevant page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
page_number subcaption
```

## History

[Section titled “History”](#history)

Added in NSIS v1.56

# UninstallText

> Specifies the texts on the uninstaller confirm page.

Specifies the texts on the uninstaller confirm page.

Accepts variables. If variables are used, they must be initialized before the uninstaller confirm page is created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
text [subtext]
```

* text: Text above the controls
* subtext: Text next to the uninstall location

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# !finalize

> This option will execute 'command' using a call to system() after the uninstaller EXE has been generated. You can typically use it to sign (Authenticode) your…

This option will execute ‘command’ using a call to *system()* after the uninstaller EXE has been generated. You can typically use it to sign (Authenticode) your installer. If ‘command’ contains a ‘%1’ it will be replaced by the executable filename. On POSIX platforms, `!execute` will use *system()* just like [`!system`](!system.md).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
command
```

## Example

[Section titled “Example”](#example)

```plaintext
!uninstfinalize 'sign.bat "%1" "MyProduct Installer" http://example.com'
```

## History

[Section titled “History”](#history)

Added in NSIS v3.08

# UninstPage

> Adds an uninstaller page. See the above sections for more information about built-in versus custom pages and about callback functions.

Adds an uninstaller page. See the above sections for more information about built-in versus custom pages and about callback functions.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
custom [creator_function] [leave_function] [caption] [/ENABLECANCEL]
internal_page_type [pre_function] [show_function] [leave_function] [/ENABLECANCEL]
```

internal\_page\_type can be:

* license - license page
* components - components selection page
* directory - installation directory selection page
* instfiles - installation page where the sections are executed
* uninstConfirm - uninstall confirmation page

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 0

# UnRegDLL

> Loads the specified DLL and calls DllUnregisterServer. The error flag is set if an error occurs (i.e. it can't load the DLL, initialize OLE, find the entry…

Loads the specified DLL and calls DllUnregisterServer. The error flag is set if an error occurs (i.e. it can’t load the DLL, initialize OLE, find the entry point, or the function returned anything other than ERROR\_SUCCESS (=0)).

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
dllfile
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# UnsafeStrCpy

> This command has not yet been officially documented

*This command has not yet been officially documented*

Works the same as [`StrCpy`](StrCpy.md), but allows ovewriting special variables such as [`$PLUGINSDIR`](../Variables/PLUGINSDIR.md). Use with extreme caution!

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
user_var(destination) str [maxlen] [start_offset]
```

## Example

[Section titled “Example”](#example)

```plaintext
UnsafeStrCpy $PLUGINSDIR "C:\CustomPluginLocation"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0

# Var

> Declare a user variable. Allowed characters for variables names: [a-z][A-Z][0-9] and '_'. All defined variables are global, even if defined in a section or a…

Declare a user variable. Allowed characters for variables names: \[a-z]\[A-Z]\[0-9] and ’\_’. All defined variables are global, even if defined in a section or a function. To make this clear, variables defined in a section or a function must use the `/GLOBAL` flag. The `/GLOBAL` flag is not required outside of sections and functions.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/GLOBAL] var_name
```

## Example

[Section titled “Example”](#example)

```plaintext
Var example


Function testVar
    Var /GLOBAL example2


    StrCpy $example "example value"
    StrCpy $example2 "another example value"
FunctionEnd
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# !verbose

> This command will set the level of verbosity. 4=all, 3=no script, 2=no info, 1=no warnings, 0=none.

This command will set the level of verbosity. 4=all, 3=no script, 2=no info, 1=no warnings, 0=none.

Passing push will cause `!verbose` to push the current verbosity level on a special stack. Passing pop will cause `!verbose` to pop the current verbosity level from the same stack and use it.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
level | push | pop
```

## Example

[Section titled “Example”](#example)

```plaintext
!verbose push
!verbose 1
!include WinMessages.nsh
!verbose pop
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# VIAddVersionKey

> Adds a field in the Version Tab of the File Properties. This can either be a field provided by the system or a user defined field. The following fields are…

Adds a field in the Version Tab of the File Properties. This can either be a field provided by the system or a user defined field. The following fields are provided by the System:

* ProductName
* Comments
* CompanyName
* LegalCopyright
* FileDescription
* FileVersion
* ProductVersion
* InternalName
* LegalTrademarks
* OriginalFilename
* PrivateBuild
* SpecialBuild

The name of these fields are translated on the target system, whereas user defined fields remain untranslated.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[/LANG=lang_id] keyname value
```

## Example

[Section titled “Example”](#example)

```plaintext
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Beta 4

# VIFileVersion

> Sets the File Version in the VS_FIXEDFILEINFO version information block (You should also set the FileVersion string with VIAddVersionKey so the information is…

Sets the File Version in the VS\_FIXEDFILEINFO version information block (You should also set the FileVersion string with [`VIAddVersionKey`](VIAddVersionKey.md) so the information is displayed at the top of the Version Tab in the Properties of the file). If you don’t provide a File Version the Product Version is used in the VS\_FIXEDFILEINFO block.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[version_string_X.X.X.X]
```

## Example

[Section titled “Example”](#example)

```plaintext
VIFileVersion 1.2.3.4
```

## History

[Section titled “History”](#history)

Added in NSIS v3.0a0

# VIProductVersion

> Adds the Product Version on top of the Version Tab in the Properties of the file.

Adds the Product Version on top of the Version Tab in the Properties of the file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[version_string_X.X.X.X]
```

## Example

[Section titled “Example”](#example)

```plaintext
VIProductVersion "1.2.3.4"
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0

# !warning

> This command will issue a warning to the script compiler. You can also add a message to this warning.

This command will issue a warning to the script compiler. You can also add a message to this warning.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[message]
```

## Example

[Section titled “Example”](#example)

```plaintext
!ifdef USE_DANGEROUS_STUFF
    !warning "using dangerous stuff"
!endif
```

## History

[Section titled “History”](#history)

Added in NSIS v1.1u

# WindowIcon

> Sets whether or not the installer's icon is displayed on certain pages.

Sets whether or not the installer’s icon is displayed on certain pages.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## History

[Section titled “History”](#history)

Added in NSIS v1.70

# WriteINIStr

> Writes entry_name=value into [section_name] of ini_filename. The error flag is set if the string could not be written to the ini file.

Writes entry\_name=value into \[section\_name] of ini\_filename. The error flag is set if the string could not be written to the ini file.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ini_filename section_name entry_name value
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteINIStr $TEMP\something.ini section1 something 123
WriteINIStr $TEMP\something.ini section1 somethingelse 1234
WriteINIStr $TEMP\something.ini section2 nsis true
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# WriteRegBin

> This command writes a block of binary data to the registry. Valid values for root_key are listed under WriteRegStr. Valuedata is in hexadecimal (e.g.…

This command writes a block of binary data to the registry. Valid values for root\_key are listed under `WriteRegStr`. Valuedata is in hexadecimal (e.g. DEADBEEF01223211151). The error flag is set if the binary data could not be written to the registry. If the registry key doesn’t exist it will be created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name valuedata
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteRegBin HKLM "Software\My Company\My Software" "Binary Value" DEADBEEF01223211151
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# WriteRegDWORD

> This command writes a dword (32 bit integer) to the registry (a user variable can be specified). Valid values for root_key are listed under WriteRegStr. The…

This command writes a dword (32 bit integer) to the registry (a user variable can be specified). Valid values for root\_key are listed under [`WriteRegStr`](WriteRegStr.md). The error flag is set if the dword could not be written to the registry. If the registry key doesn’t exist it will be created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name value
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteRegDWORD HKLM "Software\My Company\My Software" "DWORD Value" 0xDEADBEEF
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# WriteRegExpandStr

> Write a string to the registry. root_key must be one of:

Write a string to the registry. root\_key must be one of:

* HKCR or HKEY\_CLASSES\_ROOT
* HKLM or HKEY\_LOCAL\_MACHINE
* HKCU or HKEY\_CURRENT\_USER
* HKU or HKEY\_USERS
* HKCC or HKEY\_CURRENT\_CONFIG
* HKDD or HKEY\_DYN\_DATA
* HKPD or HKEY\_PERFORMANCE\_DATA
* SHCTX or SHELL\_CONTEXT

If root\_key is SHCTX or SHELL\_CONTEXT, it will be replaced with HKLM if [`SetShellVarContext`](SetShellVarContext.md) is set to all and with HKCU if [`SetShellVarContext`](SetShellVarContext.md) is set to current.

The error flag is set if the string could not be written to the registry. The type of the string will be REG\_SZ for [`WriteRegStr`](WriteRegStr.md), or REG\_EXPAND\_STR for [`WriteRegExpandStr`](WriteRegExpandStr.md). If the registry key doesn’t exist it will be created.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name value
```

## History

[Section titled “History”](#history)

Added in NSIS v1.6beta2

# WriteRegMultiStr

> Writes a multi-string value. The /REGEDIT5 switch must be used and specifies that the data is in the hex format used by .reg files on Windows 2000 and later.

Writes a multi-string value. The `/REGEDIT5` switch must be used and specifies that the data is in the hex format used by `.reg` files on Windows 2000 and later.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name value
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteRegMultiStr HKLM "Software\My Company\My Software" "String Value" "dead beef"
```

## History

[Section titled “History”](#history)

Added in NSIS v3.02

# WriteRegStr

> Write a string to the registry. See WriteRegExpandStr for more details.

Write a string to the registry. See [`WriteRegExpandStr`](WriteRegExpandStr.md) for more details.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
root_key subkey key_name value
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteRegStr HKLM "Software\My Company\My Software" "String Value" "dead beef"
```

## History

[Section titled “History”](#history)

Added in NSIS v1.0f

# WriteUninstaller

> Writes the uninstaller to the filename (and optionally path) specified. Only valid from within an install section or function, and requires that you have an…

Writes the uninstaller to the filename (and optionally path) specified. Only valid from within an install section or function, and requires that you have an uninstall section in your script. See also Uninstall configuration. You can call this one or more times to write out one or more copies of the uninstaller.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
[Path\]exename.exe
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteUninstaller $INSTDIR\uninstaller.exe
```

## History

[Section titled “History”](#history)

Added in NSIS v1.80

# XPStyle

> Sets whether or not a XP visual style manifest will be added to the installer. This manifest makes the installers controls use the new visual styles when…

Sets whether or not a XP visual style manifest will be added to the installer. This manifest makes the installers controls use the new visual styles when running on Windows XP and later. This affects the uninstaller too.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
on|off
```

## Example

[Section titled “Example”](#example)

```plaintext
WriteUninstaller $INSTDIR\uninstaller.exe
```

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# ${BannerTrimPath}

> Trim string path for banner.

Trim string path for banner.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${BannerTrimPath} "[PathString]" "[Option]" $var


"[PathString]"    ;
                  ;
"[Option]"        ; [Length][A|B|C|D]
                  ;
                  ; Length  -Maximum string length
                  ;   A     -Trim center path (default)
                  ;           (C:\root\...\third path)
                  ;           If A mode not possible Then will be used B mode
                  ;   B     -Trim right path
                  ;           (C:\root\second path\...)
                  ;           If B mode not possible Then will be used C mode
                  ;   C     -Trim right string
                  ;           (C:\root\second path\third p...)
                  ;   D     -Trim right string + filename
                  ;           (C:\root\second p...\third path)
                  ;           If D mode not possible Then will be used C mode
                  ;
$var              ; Result:  Trimmed path
```

## Examples

[Section titled “Examples”](#examples)

### Trim center path to 35 characters max

[Section titled “Trim center path to 35 characters max”](#trim-center-path-to-35-characters-max)

```plaintext
Section
    ${BannerTrimPath} "C:\Server\Documents\Terminal\license.htm" "35A" $R0
    ;$R0=C:\Server\...\Terminal\license.htm
SectionEnd
```

### Banner plugin

[Section titled “Banner plugin”](#banner-plugin)

```plaintext
!include "WinMessages.nsh"
!include "FileFunc.nsh"


Section
    Banner::show "Starting..."
    Banner::getWindow
    Pop $R1
    ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
    Banner::destroy
SectionEnd


Function LocateCallback
    StrCmp $R0 $R8 code
    StrCpy $R0 $R8
    ${BannerTrimPath} "$R8" "38B" $R8
    GetDlgItem $1 $R1 1030
    SendMessage $1 ${WM_SETTEXT} 0 "STR:$R8"


    code:
    StrCmp $R9 '' end
    ;...


    end:
    Push $0
FunctionEnd
```

### NxS plugin

[Section titled “NxS plugin”](#nxs-plugin)

```plaintext
!include "FileFunc.nsh"


Section
    nxs::Show /NOUNLOAD `$(^Name) Setup`\
      /top `Setup searching something$\nPlease wait$\nIf you can...`\
      /h 1 /can 1 /end
    ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
    nxs::Destroy
SectionEnd


Function LocateCallback
    StrCmp $R0 $R8 abortcheck
    StrCpy $R0 $R8
    ${BannerTrimPath} "$R8" "55A" $R8
    nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end


    abortcheck:
    nxs::HasUserAborted /NOUNLOAD
    Pop $0
    StrCmp $0 1 0 +2
    StrCpy $0 StopLocate


    StrCmp $R9 '' end
    ;...


    end:
    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${DirState}

> Check directory full, empty or not exist.

Check directory full, empty or not exist.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${DirState} "[path]" $var


"[path]"      ; Directory
$var          ; Result:
              ;    $var=0  (empty)
              ;    $var=1  (full)
              ;    $var=-1 (directory not found)
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${DirState} "$TEMP" $R0
    ; $R0="1"  directory is full
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${DriveSpace}

> Get total, occupied or free space of the drive.

Get total, occupied or free space of the drive.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${DriveSpace} "[Drive]" "[Options]" $var


"[Drive]"     ; Disk to check
              ;
"[Options]"   ; /D=[T|O|F]
              ;     /D=T  - Total space (default)
              ;     /D=O  - Occupied space
              ;     /D=F  - Free space
              ; /S=[B|K|M|G]
              ;     /S=B  - size in Bytes (default)
              ;     /S=K  - size in Kilobytes
              ;     /S=M  - size in Megabytes
              ;     /S=G  - size in Gigabytes
              ;
$var          ; Result: Size
```

Note:

* Error flag if disk isn’t exist or not ready
* Error flag if syntax error

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${DriveSpace} "C:\" "/D=F /S=M" $R0
    ; $R0="2530"   megabytes free on drive C:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetBaseName}

> Get file name without extension.

Get file name without extension.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetBaseName} "[FileString]" $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetBaseName} "C:\ftp\program.exe" $R0
    ; $R0="program"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetDrives}

> Find all available drives in the system.

Find all available drives in the system.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetDrives} "[Option]" "Function"


"[Option]"      ; [FDD+HDD+CDROM+NET+RAM]
                ;   FDD    Floppy Disk Drives
                ;   HDD    Hard Disk Drives
                ;   CDROM  CD-ROM Drives
                ;   NET    Network Drives
                ;   RAM    RAM Disk Drives
                ;
                ; [ALL]
                ;   Find all drives by letter (default)
                ;
"Function"      ; Callback function when found


Function "Function"
    ; $9    "drive letter"  (a:\ c:\ ...)
    ; $8    "drive type"    (FDD HDD ...)


    ; $R0-$R9  are not used (save data in them).
    ; ...


    Push $var    ; If $var="StopGetDrives" Then exit from function
FunctionEnd
```

## Examples

[Section titled “Examples”](#examples)

### Get floppy and CD-ROM drives

[Section titled “Get floppy and CD-ROM drives”](#get-floppy-and-cd-rom-drives)

```plaintext
Section
    ${GetDrives} "FDD+CDROM" "Example1"
SectionEnd


Function Example1
    MessageBox MB_OK "$9  ($8 Drive)"


    Push $0
FunctionEnd
```

### Get all drives

[Section titled “Get all drives”](#get-all-drives)

```plaintext
Section
    ${GetDrives} "ALL" "Example2"
SectionEnd


Function Example2
    MessageBox MB_OK "$9  ($8 Drive)"


    Push $0
FunctionEnd
```

### Get type of drive

[Section titled “Get type of drive”](#get-type-of-drive)

```plaintext
Section
    StrCpy $R0 "D:\"      ;Drive letter
    StrCpy $R1 "invalid"


    ${GetDrives} "ALL" "Example3"


    MessageBox MB_OK "Type of drive $R0 is $R1"
SectionEnd


Function Example3
    StrCmp $9 $R0 0 +3
    StrCpy $R1 $8
    StrCpy $0 StopGetDrives


    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetExeName}

> Get installer filename (with valid case for Windows 98/Me).

Get installer filename (with valid case for Windows 98/Me).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetExeName} $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetExeName} $R0
    ; $R0="C:\ftp\program.exe"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetExePath}

> Get installer pathname ($EXEDIR with valid case for Windows 98/Me).

Get installer pathname ([`$EXEDIR`](../../Variables/EXEDIR.md) with valid case for Windows 98/Me).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetExePath} $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetExePath} $R0
    ; $R0="C:\ftp"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetFileAttributes}

> Get attributes of file or directory.

Get attributes of file or directory.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetFileAttributes} "[File]" "[Attributes]" $var


"[File]"          ; File or directory
                  ;
"[Attributes]"    ; "ALL"  (default)
                  ;  -all attributes of file combined with "|" to output
                  ;
                  ; "READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE|
                  ; DEVICE|NORMAL|TEMPORARY|SPARSE_FILE|REPARSE_POINT|
                  ; COMPRESSED|OFFLINE|NOT_CONTENT_INDEXED|ENCRYPTED"
                  ;  -file must have specified attributes
                  ;
$var              ; Result:
                  ;    $var=attr1|attr2|... (if used "ALL")
                  ;    $var=1   file has specified attributes
                  ;    $var=0   file has no specified attributes
```

Note:

* Error flag if file doesn’t exist

## Examples

[Section titled “Examples”](#examples)

### Get all file attributes

[Section titled “Get all file attributes”](#get-all-file-attributes)

```plaintext
Section
    ${GetFileAttributes} "C:\MSDOS.SYS" "ALL" $R0
    ; $R0=READONLY|HIDDEN|SYSTEM|ARCHIVE
SectionEnd
```

### Get some file attributes

[Section titled “Get some file attributes”](#get-some-file-attributes)

```plaintext
Section
    ${GetFileAttributes} "C:\MSDOS.SYS" "SYSTEM|HIDDEN" $R0
    ; $R0=1
SectionEnd
```

### Get file attribute “NORMAL”

[Section titled “Get file attribute “NORMAL””](#get-file-attribute-normal)

```plaintext
Section
    ${GetFileAttributes} "C:\MSDOS.SYS" "NORMAL" $R0
    ; $R0=0
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetFileExt}

> Get extension of file.

Get extension of file.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetFileExt} "[FileString]" $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetFileExt} "C:\ftp\program.exe" $R0
    ; $R0="exe"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetFileName}

> Get last part from directory path.

Get last part from directory path.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetFileName} "[PathString]" $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetFileName} "C:\Program Files\Winamp\uninstwa.exe" $R0
    ; $R0="uninstwa.exe"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetFileVersion}

> Get version information from executable file.

Get version information from executable file.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetFileVersion} "[Executable]" $var


"[Executable]"      ; Executable file (*.exe *.dll ...)
$var                ; Result: Version number
```

Note:

* Error flag if file doesn’t exist
* Error flag if file doesn’t contain version information

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetFileVersion} "C:\ftp\program.exe" $R0
    ; $R0="1.1.0.12"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetOptions}

> Get options from command line parameters.

Get options from command line parameters.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetOptions} "[Parameters]" "[Option]" $var


"[Parameters]"     ; command line parameters
                   ;
"[Option]"         ; option name
                   ;
$var               ; Result: option string
```

Note:

* Error flag if option not found
* First option symbol it is delimiter

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${GetOptions} "/S /T" "/T"  $R0


    IfErrors 0 +2
    MessageBox MB_OK "Not found" IDOK +2
    MessageBox MB_OK "Found"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${GetOptions} "-INSTDIR=C:\Program Files\Common Files -SILENT=yes" "-INSTDIR="  $R0
    ;$R0=C:\Program Files\Common Files
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${GetOptions} '/SILENT=yes /INSTDIR="C:/Program Files/Common Files" /ADMIN=password' "/INSTDIR="  $R0
    ;$R0=C:/Program Files/Common Files
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${GetOptions} `-SILENT=yes -INSTDIR='"C:/Program Files/Common Files"' -ADMIN=password` "-INSTDIR="  $R0
    ;$R0="C:/Program Files/Common Files"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetOptionsS}

> Get case-sensitive options from command line parameters.

Get case-sensitive options from command line parameters.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetOptionsS} "[Parameters]" "[Option]" $var


"[Parameters]"     ; command line parameters
                   ;
"[Option]"         ; option name
                   ;
$var               ; Result: option string
```

Note:

* Error flag if option not found
* First option symbol it is delimiter

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${GetOptionsS} "/S /T" "/T"  $R0


    IfErrors 0 +2
    MessageBox MB_OK "Not found" IDOK +2
    MessageBox MB_OK "Found"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${GetOptionsS} "-INSTDIR=C:\Program Files\Common Files -SILENT=yes" "-INSTDIR="  $R0
    ;$R0=C:\Program Files\Common Files
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${GetOptionsS} '/SILENT=yes /INSTDIR="C:/Program Files/Common Files" /ADMIN=password' "/INSTDIR="  $R0
    ;$R0=C:/Program Files/Common Files
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${GetOptionsS} `-SILENT=yes -INSTDIR='"C:/Program Files/Common Files"' -ADMIN=password` "-INSTDIR="  $R0
    ;$R0="C:/Program Files/Common Files"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetParameters}

> Get command line parameters.

Get command line parameters.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetParameters} $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetParameters} $R0
    ; $R0="[parameters]"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetParent}

> Get parent directory.

Get parent directory.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetParent} "[PathString]" $var
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${GetParent} "C:\Program Files\Winamp\uninstwa.exe" $R0
    ; $R0="C:\Program Files\Winamp"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetRoot}

> Get root directory.

Get root directory.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetRoot} "[FullPath]" $var
```

## Examples

[Section titled “Examples”](#examples)

### Get root of local folder

[Section titled “Get root of local folder”](#get-root-of-local-folder)

```plaintext
Section
    ${GetRoot} "C:\Program Files\NSIS" $R0
    ; $R0="C:"
SectionEnd
```

### Get root of network share

[Section titled “Get root of network share”](#get-root-of-network-share)

```plaintext
Section
    ${GetRoot} "\\SuperPimp\NSIS\Source\exehead\Ui.c" $R0
    ; $R0="\\SuperPimp\NSIS"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetSize}

> Note:

* Find the size of a file, files mask or directory.
* Find the sum of the files, directories and subdirectories.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetSize} "[Path]" "[Options]" $var1 $var2 $var3


"[Path]"      ; Disk or Directory
              ;
"[Options]"   ; /M=[mask]
              ;     /M=*.*         - Find all (default)
              ;     /M=*.doc       - Find Work.doc, 1.doc ...
              ;     /M=Pho*        - Find PHOTOS, phone.txt ...
              ;     /M=win???.exe  - Find winamp.exe, winver.exe ...
              ;     /M=winamp.exe  - Find winamp.exe only
              ; /S=No:No[B|K|M|G]
              ;     /S=      - Don't find file size (faster) (default)
              ;     /S=0:0B  - Find only files of 0 Bytes exactly
              ;     /S=5:9K  - Find only files of 5 to 9 Kilobytes
              ;     /S=:10M  - Find only files of 10 Megabyte or less
              ;     /S=1G    - Find only files of 1 Gigabyte or more
              ; /G=[1|0]
              ;     /G=1     - Find with subdirectories (default)
              ;     /G=0     - Find without subdirectories
              ;
$var1         ; Result1: Size
$var2         ; Result2: Sum of files
$var3         ; Result3: Sum of directories
```

Note:

* Error flag if disk or directory isn’t exist
* Error flag if syntax error
* See also [Locate plugin](http://nsis.sourceforge.net/Locate_plugin)

## Examples

[Section titled “Examples”](#examples)

### Find file size in kilobytes

[Section titled “Find file size in kilobytes”](#find-file-size-in-kilobytes)

```plaintext
Section
    ${GetSize} "C:\WINDOWS" "/M=Explorer.exe /S=0K /G=0" $0 $1 $2
    ; $0="220" Kb
    ; $1="1"   files
    ; $2=""    directories


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd
```

### Find folder size in megabytes

[Section titled “Find folder size in megabytes”](#find-folder-size-in-megabytes)

```plaintext
Section
    ${GetSize} "C:\Installs\Reanimator\Drivers" "/S=0M" $0 $1 $2
    ; $0="132" Mb
    ; $1="555" files
    ; $2="55"  directories


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd
```

### Find sum of files and folders (no subfolders)

[Section titled “Find sum of files and folders (no subfolders)”](#find-sum-of-files-and-folders-no-subfolders)

```plaintext
Section
    ${GetSize} "C:\WINDOWS" "/G=0" $0 $1 $2
    ; $0=""    size
    ; $1="253" files
    ; $2="46"  directories


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${GetTime}

> Note:

* Get local or system time.
* Get file time (access, creation and modification).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${GetTime} "[File]" "[Option]" $var1 $var2 $var3 $var4 $var5 $var6 $var7
"[File]"        ; Ignored if "L" or "LS"
                ;
"[Option]"      ; [Options]
                ;   L   Local time
                ;   A   last Access file time
                ;   C   Creation file time
                ;   M   Modification file time
                ;   LS  System time (UTC)
                ;   AS  last Access file time (UTC)
                ;   CS  Creation file time (UTC)
                ;   MS  Modification file time (UTC)
                ;
$var1           ; Result1: day
$var2           ; Result2: month
$var3           ; Result3: year
$var4           ; Result4: day of week name
$var5           ; Result5: hour
$var6           ; Result6: minute
$var7           ; Result7: seconds
```

Note:

* Error flag if file isn’t exist
* Error flag if syntax error
* See also [Time plugin](http://nsis.sourceforge.net/Time_plugin)

## Examples

[Section titled “Examples”](#examples)

### Get local time

[Section titled “Get local time”](#get-local-time)

```plaintext
Section
    ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
    ; $0="01"      day
    ; $1="04"      month
    ; $2="2005"    year
    ; $3="Friday"  day of week name
    ; $4="16"      hour
    ; $5="05"      minute
    ; $6="50"      seconds


    MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
SectionEnd
```

### Get file time

[Section titled “Get file time”](#get-file-time)

```plaintext
Section
    ${GetTime} "$WINDIR\Explorer.exe" "C" $0 $1 $2 $3 $4 $5 $6
    ; $0="12"       day
    ; $1="10"       month
    ; $2="2004"     year
    ; $3="Tuesday"  day of week name
    ; $4="2"        hour
    ; $5="32"       minute
    ; $6="03"       seconds


    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
SectionEnd
```

### Get system time

[Section titled “Get system time”](#get-system-time)

```plaintext
Section
    ${GetTime} "" "LS" $0 $1 $2 $3 $4 $5 $6
    ; $0="01"      day
    ; $1="04"      month
    ; $2="2005"    year
    ; $3="Friday"  day of week name
    ; $4="11"      hour
    ; $5="05"      minute
    ; $6="50"      seconds


    MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
SectionEnd
```

### Convert time to 12-hour format AM/PM

[Section titled “Convert time to 12-hour format AM/PM”](#convert-time-to-12-hour-format-ampm)

```plaintext
Section
    ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6


    StrCmp $4 0 0 +3
    StrCpy $4 12
    goto +3
    StrCmp $4 12 +5
    IntCmp $4 12 0 0 +3
    StrCpy $7 AM
    goto +3
    IntOp $4 $4 - 12
    StrCpy $7 PM


    MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6 $7'
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${Locate}

> Find files, directories and empty directories with mask and size options.

Find files, directories and empty directories with mask and size options.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Locate} "[Path]" "[Options]" "Function"


"[Path]"      ; Disk or Directory
              ;
"[Options]"   ; /L=[FD|F|D|DE|FDE]
              ;     /L=FD    - Locate Files and Directories (default)
              ;     /L=F     - Locate Files only
              ;     /L=D     - Locate Directories only
              ;     /L=DE    - Locate Empty Directories only
              ;     /L=FDE   - Locate Files and Empty Directories
              ; /M=[mask]
              ;     /M=*.*         - Locate all (default)
              ;     /M=*.doc       - Locate Work.doc, 1.doc ...
              ;     /M=Pho*        - Locate PHOTOS, phone.txt ...
              ;     /M=win???.exe  - Locate winamp.exe, winver.exe ...
              ;     /M=winamp.exe  - Locate winamp.exe only
              ; /S=No:No[B|K|M|G]
              ;     /S=      - Don't locate file size (faster) (default)
              ;     /S=0:0B  - Locate only files of 0 Bytes exactly
              ;     /S=5:9K  - Locate only files of 5 to 9 Kilobytes
              ;     /S=:10M  - Locate only files of 10 Megabyte or less
              ;     /S=1G    - Locate only files of 1 Gigabyte or more
              ; /G=[1|0]
              ;     /G=1     - Locate with subdirectories (default)
              ;     /G=0     - Locate without subdirectories
              ; /B=[0|1]
              ;     /B=0     - Banner isn't used (default)
              ;     /B=1     - Banner is used. Callback when function
              ;                start to search in new directory
"Function"    ; Callback function when found


Function "Function"
    ; $R9    "path\name"
    ; $R8    "path"
    ; $R7    "name"
    ; $R6    "size"  ($R6="" if directory, $R6="0" if file with /S=)


    ; $R0-$R5  are not used (save data in them).
    ; ...


    Push $var    ; If $var="StopLocate" Then exit from function
FunctionEnd
```

Note:

* Error flag if disk or directory isn’t exist
* Error flag if syntax error
* See also [Locate plugin](http://nsis.sourceforge.net/Locate_plugin)

## Examples

[Section titled “Examples”](#examples)

### Find one file

[Section titled “Find one file”](#find-one-file)

```plaintext
Section
    ${Locate} "C:\ftp" "/L=F /M=RPC DCOM.rar /S=1K" "Example1"
    ; 'RPC DCOM.rar' file in 'C:\ftp' with size 1 Kb or more


    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    MessageBox MB_OK "$$R0=$R0"
SectionEnd


Function Example1
    StrCpy $R0 $R9
    ; $R0="C:\ftp\files\RPC DCOM.rar"


    MessageBox MB_YESNO '$R0$\n$\nFind next?' IDYES +2
    StrCpy $0 StopLocate


    Push $0
FunctionEnd
```

### Write results to a text file

[Section titled “Write results to a text file”](#write-results-to-a-text-file)

```plaintext
Section
    GetTempFileName $R0
    FileOpen $R1 $R0 w
    ${Locate} "C:\ftp" "/S=:2M /G=0" "Example2"
    ; folders and all files with size 2 Mb or less
    ; don't scan subdirectories
    FileClose $R1


    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    Exec '"notepad.exe" "$R0"'
SectionEnd


Function Example2
    StrCmp $R6 '' 0 +3
    FileWrite $R1 "Directory=$R9$\r$\n"
    goto +2
    FileWrite $R1 "File=$R9  Size=$R6 Mb$\r$\n"


    Push $0
FunctionEnd
```

### Write results to an INI file

[Section titled “Write results to an INI file”](#write-results-to-an-ini-file)

```plaintext
Section
    GetTempFileName $R0
    ${Locate} "C:\ftp" "/L=F /S=0K" "Example3"
    ; all files in 'C:\ftp' with size detect in Kb


    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    Exec '"notepad.exe" "$R0"'
SectionEnd


Function Example3
    WriteINIStr $R0 "$R8" "$R7" "$R6 Kb"


    Push $0
FunctionEnd
```

### Delete empty directories

[Section titled “Delete empty directories”](#delete-empty-directories)

```plaintext
Section
    StrCpy $R2 0
    StrCpy $R3 0


    loop:
    StrCpy $R1 0
    ${Locate} "C:\ftp" "/L=DE" "Example4"
    IntOp $R3 $R3 + 1
    IntOp $R2 $R2 + $R1
    StrCmp $R0 StopLocate +2
    StrCmp $R1 0 0 loop


    IfErrors 0 +2
    MessageBox MB_OK 'error' IDOK +2
    MessageBox MB_OK '$R2 directories were removed$\n$R3 loops'
SectionEnd


Function Example4
    MessageBox MB_YESNOCANCEL 'Delete empty "$R9"?' IDNO end IDCANCEL cancel
    RMDir $R9
    IntOp $R1 $R1 + 1
    goto end


    cancel:
    StrCpy $R0 StopLocate


    end:
    Push $R0
FunctionEnd
```

### Move all files into one folder

[Section titled “Move all files into one folder”](#move-all-files-into-one-folder)

```plaintext
Section
    StrCpy $R0 "C:\ftp"   ;Directory move from
    StrCpy $R1 "C:\ftp2"  ;Directory move into


    StrCpy $R2 0
    StrCpy $R3 0
    ${Locate} "$R0" "/L=F" "Example5"


    IfErrors 0 +2
    MessageBox MB_OK 'error' IDOK +4
    StrCmp $R3 0 0 +2
    MessageBox MB_OK '$R2 files were moved' IDOK +2
    MessageBox MB_OK '$R2 files were moved$\n$R3 files were NOT moved'
SectionEnd


Function Example5
    StrCmp $R8 $R1 +6
    IfFileExists '$R1\$R7' +4
    Rename $R9 '$R1\$R7'
    IntOp $R2 $R2 + 1
    goto +2
    IntOp $R3 $R3 + 1


    Push $0
FunctionEnd
```

### Copy files with log

[Section titled “Copy files with log”](#copy-files-with-log)

```plaintext
Section
    StrCpy $R0 "C:\ftp"   ;Directory copy from
    StrCpy $R1 "C:\ftp2"  ;Directory copy into
    StrLen $R2 $R0


    GetTempFileName $0
    FileOpen $R3 $0 w
    ${Locate} "$R0" "/L=FDE" "Example6"
    FileClose $R3


    IfErrors 0 +2
    MessageBox MB_OK 'error'


    Exec '"notepad.exe" "$0"'     ;view log
SectionEnd


Function Example6
    StrCpy $1 $R8 '' $R2


    StrCmp $R6 '' 0 +3
    CreateDirectory '$R1$1\$R7'
    goto end
    CreateDirectory '$R1$1'
    CopyFiles /SILENT $R9 '$R1$1'


    IfFileExists '$R1$1\$R7' 0 +3
    FileWrite $R3 "-old:$R9  -new:$R1$1\$R7  -success$\r$\n"
    goto +2
    FileWrite $R3 "-old:$R9  -new:$R1$1\$R7  -failed$\r$\n"


    end:
    Push $0
FunctionEnd
```

### Recreate directory structure

[Section titled “Recreate directory structure”](#recreate-directory-structure)

```plaintext
Section
    StrCpy $R0 "C:\ftp"     ;Directory structure from
    StrCpy $R1 "C:\ftp2"    ;Directory structure into
    StrLen $R2 $R0


    ${Locate} "$R0" "/L=D" "Example7"


    IfErrors 0 +2
    MessageBox MB_OK 'error'
SectionEnd


Function Example7
    StrCpy $1 $R9 '' $R2
    CreateDirectory '$R1$1'


    Push $0
FunctionEnd
```

### Locate with banner - NxS plugin required

[Section titled “Locate with banner - NxS plugin required”](#locate-with-banner---nxs-plugin-required)

```plaintext
Section
    nxs::Show /NOUNLOAD `$(^Name) Setup` /top `Setup searching something$\r$\nPlease wait... If you can..` /h 1 /can 1 /end
    ${Locate} "C:\WINDOWS" "/L=F /M=*.inf /B=1" "Example8"
    nxs::Destroy
SectionEnd


Function Example8
    StrCmp $R0 $R8 abortcheck
    StrCpy $R0 $R8
    nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end


    abortcheck:
    nxs::HasUserAborted /NOUNLOAD
    Pop $0
    StrCmp $0 1 0 +2
    StrCpy $0 StopLocate


    StrCmp $R9 '' end
    ;...


    end:
    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${RefreshShellIcons}

> After changing file associations, you can call this function to refresh the shell immediately.

After changing file associations, you can call this function to refresh the shell immediately.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${RefreshShellIcons}
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    WriteRegStr HKCR "Winamp.File\DefaultIcon" "" "$PROGRAMFILES\Winamp\WINAMP.EXE,2"
    ${RefreshShellIcons}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${AndIf}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements.

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${AndIf} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true
StrCpy $1 true


${If} $0 == true
${AndIf} $1 == true
    MessageBox MB_OK "Everything's true"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 2 > 1
${AndIf} 2 < 3
    MessageBox MB_OK "2 is greater than 1 and smaller than 3"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${If} ${FileExists} $SYSDIR\calc.exe
${AndIf} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "We have both"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${AndIfNot}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements. ${AndIfNot} and ${AndUnless} are equivalent and…

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements. `${AndIfNot}` and [`${AndUnless}`](AndUnless.md) are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${AndIfNot} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true
StrCpy $1 true


${If} $0 == true
${AndIfNot} $1 == false
    MessageBox MB_OK "Everything's true"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 2 > 1
${AndIfNot} 2 < 1
    MessageBox MB_OK "2 is always greater than 1"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${IfNot} ${FileExists} $SYSDIR\calc.exe
${AndIfNot} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "We have neither"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${AndUnless}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements. ${AndIfNot} and ${AndUnless} are equivalent and…

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements. [`${AndIfNot}`](AndIfNot.md) and `${AndUnless}` are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${AndUnless} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true
StrCpy $1 true


${Unless} $0 == true
${AndUnless} $1 == true
    MessageBox MB_OK "Nothing's true"
${EndUnless}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${Unless} 2 == 2
${AndUnless} 1 == 1
    MessageBox MB_OK "This will never show"
${EndUnless}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${Unless} ${FileExists} $SYSDIR\calc.exe
${AndUnless} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "We have neither"
${EndUnless}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Break}

> Breaks a block of statements.

Breaks a block of statements.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Break}
```

## Examples

[Section titled “Examples”](#examples)

### Simple example

[Section titled “Simple example”](#simple-example)

```plaintext
${For} $1 1 10
    ${Break}
    MessageBox MB_OK "This will never show"
${Next}
```

### In combination with a MessageBox

[Section titled “In combination with a MessageBox”](#in-combination-with-a-messagebox)

```plaintext
${For} $1 1 10
    ${IfCmd} MessageBox MB_YESNO "We're at $1, continue up to 10?" IDYES ${||} ${Break} ${|}
${Next}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Case}

> Executes one of several blocks of statements, depending on the value of an expression. Use ${Break} to prevent fall-through to the next ${Case} section.

Executes one of several blocks of statements, depending on the value of an expression. Use [`${Break}`](Break.md) to prevent fall-through to the next `${Case}` section.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Case[2|3|4|5]} value(s)
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 1


${Select} $0
    ${Case} "1"
        MessageBox MB_OK "$$0 is 1"
        ${Break}
    ${Case} "2"
        MessageBox MB_OK "$$0 isn't 2"
        ${Break}
    ${Case2} "3" "4"
        MessageBox MB_OK "$$0 isn't 3 or 4"
        ${Break}
    ${Case3} "5" "6" "7"
        MessageBox MB_OK "$$0 isn't 5, 6 or 7"
        ${Break}
    ${CaseElse}
        MessageBox MB_OK "$$0 isn't anything else"
${EndSelect}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${CaseElse}

> Executes one of several blocks of statements, depending on the value of an expression. ${CaseElse} and ${Default} are equivalent and interchangeable.

Executes one of several blocks of statements, depending on the value of an expression. `${CaseElse}` and [`${Default}`](Default.md) are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${CaseElse}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 1


${Select} $0
    ${Case} "1"
        MessageBox MB_OK "$$0 is 1"
    ${Case} "2"
        MessageBox MB_OK "$$0 isn't 2"
    ${CaseElse}
        MessageBox MB_OK "$$0 isn't anything else"
${EndSelect}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Continue}

> Continues a block of statements.

Continues a block of statements.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Continue}
```

## Example

[Section titled “Example”](#example)

```plaintext
${Do}
    MessageBox MB_YESNO "Stop this loop?" IDYES ${Break} ID_NO ${Continue}
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Default}

> Executes one of several blocks of statements, depending on the value of an expression. ${CaseElse} and ${Default} are equivalent and interchangeable.

Executes one of several blocks of statements, depending on the value of an expression. [`${CaseElse}`](CaseElse.md) and `${Default}` are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Default}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 1


${Select} $0
    ${Case} "1"
        MessageBox MB_OK "$$0 is 1"
    ${Case} "2"
        MessageBox MB_OK "$$0 isn't 2"
    ${Default}
        MessageBox MB_OK "$$0 isn't anything else"
${EndSelect}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Do}

> Repeats a block of statements until stopped, or depending on the value of an expression.

Repeats a block of statements until stopped, or depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Do}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${Do}
    IntOp $0 $0 + 1
    ${If} $0 > 10
        ${ExitDo}
    ${EndIf}
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${DoUntil}

> Repeats a block of statements until stopped, or depending on the value of an expression.

Repeats a block of statements until stopped, or depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${DoUntil} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${DoUntil} $0 > 10
    IntOp $0 $0 + 1
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${DoWhile}

> Repeats a block of statements until stopped, or depending on the value of an expression. ${DoWhile} and ${While} are equivalent and interchangeable.

Repeats a block of statements until stopped, or depending on the value of an expression. `${DoWhile}` and [`${While}`](While.md) are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${DoWhile} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${DoWhile} $0 > 5
    IntOp $0 $0 + 1
${EndWhile}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Else}

> Conditionally executes a block of statements, depending on the value of an expression. Requires opening condition ${If} or ${IfNot}.

Conditionally executes a block of statements, depending on the value of an expression. Requires opening condition [`${If}`](If.md) or [`${IfNot}`](IfNot.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Else}
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${If} $0 == true
    MessageBox MB_OK "$$0 is always true"
${Else}
    MessageBox MB_OK "$$0 is never false"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 1 > 0
    MessageBox MB_OK "1 is greater than 0"
${Else}
    MessageBox MB_OK "Something went wrong!"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${IfNot} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "Could not find notepad.exe"
${Else}
    Exec $SYSDIR\notepad.exe
${EndIf}
```

### Section test

[Section titled “Section test”](#section-test)

```plaintext
Section "My Section" mySection
    MessageBox MB_OK "Section is selected!""


    ${If} ${SectionIsSelected} ${mySection}
        MessageBox MB_OK "Section is selected (and we knew that already!)"
    ${Else}
        MessageBox MB_OK "This will never show, dummy!"
    ${EndIf}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ElseIf}

> Conditionally executes a block of statements, depending on the value of an expression. Requires opening condition ${If} or ${IfNot}.

Conditionally executes a block of statements, depending on the value of an expression. Requires opening condition [`${If}`](If.md) or [`${IfNot}`](IfNot.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ElseIf} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${If} $0 == true
    MessageBox MB_OK "It's true"
${ElseIf} $0 == pie
    MessageBox MB_OK "$0 will never be a pie"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 1 > 0
    MessageBox MB_OK "1 is greater than 0"
${ElseIf} 1 < 0
    MessageBox MB_OK "1 will never be smaller than 0"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${If} ${FileExists} $SYSDIR\notepad.exe
    Exec $SYSDIR\notepad.exe
${ElseIf} ${FileExists} $EXEDIR\notepad.exe
    Exec $EXEDIR\notepad.exe
${Else}
    MessageBox MB_OK "Could not find notepad.exe"
${EndIf}
```

### Section test

[Section titled “Section test”](#section-test)

```plaintext
Section "My Section" mySection
    MessageBox MB_OK "Executing section"


    ${If} ${SectionIsSelected} ${mySection}
    ${AndIf} ${SectionIsReadOnly} ${mySection}
        MessageBox MB_OK "Ready-only section was selected"
    ${ElseIf} ${SectionIsReadOnly} ${mySection}
    ${AndIfNot} ${SectionIsSelected} ${mySection}
        MessageBox MB_OK "This will never show, dummy!"
    ${EndIf}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ElseIfNot}

> Conditionally executes a block of statements, depending on the value of an expression. ${ElseIfNot} and ${ElseUnless} are equivalent and interchangeable, as are…

Conditionally executes a block of statements, depending on the value of an expression. `${ElseIfNot}` and [`${ElseUnless}`](ElseUnless.md) are equivalent and interchangeable, as are [`${IfNot}`](IfNot.md) and [`${Unless}`](Unless.md). Requires opening condition [`${If}`](If.md) or [`${IfNot}`](IfNot.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ElseIfNot} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${IfNot} $0 == true
    MessageBox MB_OK "$$0 is true"
${ElseIfNot} $0 == false
    MessageBox MB_OK "$$0 isn't false"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${IfNot} ${FileExists} $SYSDIR\notepad.exe
${AndIf} ${FileExists} $EXEDIR\notepad.exe
    ; we found a copy in $EXEDIR
    Exec $EXEDIR\notepad.exe
${ElseIfNot} ${FileExists} $SYSDIR\notepad.exe
${AndIfNot} ${FileExists} $EXEDIR\notepad.exe
    MessageBox MB_OK "Could not find any notepad.exe"
${ElseIf} ${FileExists} $SYSDIR\notepad.exe
    ; we should've done that in the first place!
    Exec $SYSDIR\notepad.exe
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ElseUnless}

> Conditionally executes a block of statements, depending on the value of an expression. ${ElseIfNot} and ${ElseUnless} are equivalent and interchangeable, as are…

Conditionally executes a block of statements, depending on the value of an expression. [`${ElseIfNot}`](ElseIfNot.md) and `${ElseUnless}` are equivalent and interchangeable, as are [`${IfNot}`](IfNot.md) and [`${Unless}`](Unless.md). Requires opening condition [`${If}`](If.md) or [`${IfNot}`](IfNot.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ElseUnless} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 true


${Unless} $0 == true
    MessageBox MB_OK "$$0 is true"
${ElseUnless} $0 == false
    MessageBox MB_OK "$$0 isn't false"
${EndUnless}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${EndIf}

> Ends an open condition started by ${If} or ${IfNot}.

Ends an open condition started by [`${If}`](If.md) or [`${IfNot}`](IfNot.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${EndIf}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 true


${If} $0 == true
    MessageBox MB_OK "It's true"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${EndSelect}

> Ends an open block of statements started by ${Select}.

Ends an open block of statements started by [`${Select}`](Select.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${EndSelect}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 1


${Select} $0
    ${Case} "1"
        MessageBox MB_OK "$$0 is 1"
    ${Case} "2"
        MessageBox MB_OK "$$0 isn't 2"
    ${CaseElse}
        MessageBox MB_OK "$$0 isn't anything else"
${EndSelect}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${EndSwitch}

> Ends an open block of labels started by ${Switch}.

Ends an open block of labels started by [`${Switch}`](Switch.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${EndSwitch}
```

## Example

[Section titled “Example”](#example)

```plaintext
{For} $0 1 10
    ${Switch} $0
        ${Case} "1"
            MessageBox MB_OK "$$0 is 1"
        ${Case} "2"
            MessageBox MB_OK "$$0 is 2"
        ${Case2} "3" "5"
            MessageBox MB_OK "$$0 is 3 or 5"
        ${CaseElse}
            MessageBox MB_OK "$$0 is something else ($0)"
    ${EndSwitch}
${Next}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ExitDo}

> Exits a block of statements until started by ${Do}, ${DoUntil} or ${DoWhile}.

Exits a block of statements until started by [`${Do}`](Do.md), [`${DoUntil}`](DoUntil.md) or [`${DoWhile}`](DoWhile.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ExitDo}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${Do}
    IntOp $0 $0 + 1
    ${If} $0 > 10
        ${ExitDo}
    ${EndIf}
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ExitFor}

> Repeats a block of statements varying the value of a variable.

Repeats a block of statements varying the value of a variable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ExitFor} expression
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 ""


${For} $1 1 10
    StrCpy $0 $0$1
    ${If} $1 == 5
        ; let's interrupt this at 5
        ${ExitFor}
    ${EndIf}
${Next}


; $0 = 12345
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ExitWhile}

> Exits a block of statements until started by ${DoWhile}.

Exits a block of statements until started by [`${DoWhile}`](DoWhile.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ExitWhile}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0
ClearErrors


${DoWhile} $0 < 10
    IntOp $0 $0 + 1
    ${If} ${Errors}
        MessageBox MB_OK "An unexpected error occured!"
        ${ExitWhile}
    ${EndIf}
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${For}

> Repeats a block of statements varying the value of a variable.

Repeats a block of statements varying the value of a variable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${For} expression
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 ""


${For} $1 1 5
    StrCpy $0 $0$1
${Next}


; $0 = 12345
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${ForEach}

> Repeats a block of statements varying the value of a variable.

Repeats a block of statements varying the value of a variable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ForEach} expression
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 ""


${ForEach} $1 9 0 - 1
    StrCpy $0 $0$1
${Next}


; $0 = 9876543210
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${If}

> Conditionally executes a block of statements, depending on the value of an expression.

Conditionally executes a block of statements, depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${If} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${If} $0 == true
    MessageBox MB_OK "It's true"
${Else}
    MessageBox MB_OK "This will never be true"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 1 > 0
    MessageBox MB_OK "1 is greater than 0"
${EndIf}


${If} 2 > 1
${AndIf} 2 < 3
    MessageBox MB_OK "2 is greater than 1 and smaller than 3"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${If} ${FileExists} $SYSDIR\notepad.exe
    Exec $SYSDIR\notepad.exe
${Else}
    MessageBox MB_OK "Could not find notepad.exe"
${EndIf}


${If} ${FileExists} $PROGAMFILES\*.*
    MessageBox MB_OK "Directory $$PROGRAMFILES exists"
${EndIf}
```

### Section test

[Section titled “Section test”](#section-test)

```plaintext
Section "My Section" mySection
    MessageBox MB_OK "Executing section"


    ${If} ${SectionIsSelected} ${mySection}
        MessageBox MB_OK "It's selected, dummy!"
    ${EndIf}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${IfCmd}

> Conditionally executes an inline statement, depending on a true value of the provided NSIS function. This is short for

Conditionally executes an inline statement, depending on a true value of the provided NSIS function. This is short for

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${IfCmd} command ${||} statement ${|}
```

This is short for

```plaintext
${IfThen} ${Cmd} `command` ${|} statement ${|}
```

which is short for

```plaintext
${If} ${Cmd} `command`
    statement
${EndIf}
```

Notes:

* the command is terminated by `${||}`, not enclosed by quotes as with `${Cmd}`
* you can (probably) use any command that accepts a jump target (label etc.) as the last parameter
* only one jump target is supported

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $R2 ""


${IfCmd} MessageBox MB_YESNO "Please click Yes" IDYES ${||} StrCpy $R2 $R2A ${|}


${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please click No" IDYES`
    StrCpy $R2 $R2B
${EndUnless}


${If} $R2 == "AB"
    DetailPrint "PASSED IfCmd/If Cmd test"
${Else}
    DetailPrint "FAILED IfCmd/If Cmd test"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${IfNot}

> Conditionally executes a block of statements, depending on the value of an expression. ${IfNot} and ${Unless} are equivalent and interchangeable, as are…

Conditionally executes a block of statements, depending on the value of an expression. `${IfNot}` and [`${Unless}`](Unless.md) are equivalent and interchangeable, as are [`${ElseIfNot}`](ElseIfNot.md) and [`${ElseUnless}`](ElseUnless.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${IfNot} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${IfNot} $0 == true
    MessageBox MB_OK "It's false"
${EndIf}


${IfNot} $0 != true
    MessageBox MB_OK "It's true (but I'd use $${If} $$0 == true)"
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${IfNot} 1 > 0
    MessageBox MB_OK "This is never true"
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${IfNot} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "Could not find notepad.exe"
${Else}
    Exec $SYSDIR\notepad.exe
${EndIf}


${IfNot} ${FileExists} $PROGAMFILES\*.*
    MessageBox MB_OK "Directory $$PROGRAMFILES doesn't exist"
${EndIf}
```

### Section test

[Section titled “Section test”](#section-test)

```plaintext
Section "My Section" mySection
    MessageBox MB_OK "Executing section"


    ${IfNot} ${SectionIsSelected} ${mySection}
        MessageBox MB_OK "This will never show, dummy!"
    ${EndIf}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${IfNotThen}

> Conditionally executes an inline statement, depending on the value of an expression.

Conditionally executes an inline statement, depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${IfNotThen} expression statement
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 true


${IfNotThen} $0 == false ${|} StrCpy $1 false ${|}
    MessageBox MB_OK "Whenever $$0 is true, $$1 is false"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${IfThen}

> Conditionally executes an inline statement, depending on the value of an expression.

Conditionally executes an inline statement, depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${IfThen} expression statement
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 true
${IfThen} $0 == true ${|} StrCpy $1 false ${|}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Loop}

> Loops a block of statements started by ${Do}, ${DoUntil} or ${DoWhile}.

Loops a block of statements started by [`${Do}`](Do.md), [`${DoUntil}`](DoUntil.md) or [`${DoWhile}`](DoWhile.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Loop}
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${Do}
    IntOp $0 $0 + 1
    ${If} $0 > 10
        ${ExitDo}
    ${EndIf}
${Loop}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${LoopUntil}

> Loops a block of statements started by ${Do}, depending on the value of an expression.

Loops a block of statements started by [`${Do}`](Do.md), depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${LoopUntil} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 10


${Do}
    IntOp $0 $0 - 1
${LoopUntil} $0 == 0
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${LoopWhile}

> Loops a block of statements started by ${Do}, depending on the value of an expression.

Loops a block of statements started by [`${Do}`](Do.md), depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${LoopWhile} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${Do}
    IntOp $0 $0 + 1
${LoopWhile} $0 < 10
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${OrIf}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements.

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${OrIf} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true
StrCpy $1 false


${If} $0 == true
${OrIf} $1 == false
    MessageBox MB_OK "Either way..."
${EndIf}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${If} 2 > 1
${OrIf} 2 < 3
    MessageBox MB_OK "Either way..."
${EndIf}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${If} ${FileExists} $EXEDIR\notepad.exe
${OrIf} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "We have notepad.exe"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${OrIfNot}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements. ${OrIfNot} and ${OrUnless} are equivalent and…

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements. `${OrIfNot}` and [`${OrUnless}`](OrUnless.md) are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${OrIfNot} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 false
StrCpy $1 false


${IfNot} $0 == true
${OrIfNot} $1 == true
    MessageBox MB_OK "Something's not true"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${OrUnless}

> Adds any number of extra conditions to If, IfNot, Unless, ElseIf, ElseIfNot and ElseUnless statements. ${OrIfNot} and ${OrUnless} are equivalent and…

Adds any number of extra conditions to [`If`](If.md), [`IfNot`](IfNot.md), [`Unless`](Unless.md), [`ElseIf`](ElseIf.md), [`ElseIfNot`](ElseIfNot.md) and [`ElseUnless`](ElseUnless.md) statements. [`${OrIfNot}`](OrIfNot.md) and `${OrUnless}` are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${OrUnless} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 false
StrCpy $1 false


${Unless} $0 == true
${OrUnless} $1 == true
    MessageBox MB_OK "Something's not true"
${EndUnless}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Select}

> Executes one of several blocks of statements, depending on the value of an expression.

Executes one of several blocks of statements, depending on the value of an expression.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Select} expression
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 1


${Select} $0
    ${Case} "1"
        MessageBox MB_OK "$$0 is 1"
    ${Case} "2"
        MessageBox MB_OK "$$0 isn't 2"
    ${Case2} "3" "4"
        MessageBox MB_OK "$$0 isn't 3 or 4"
    ${CaseElse}
        MessageBox MB_OK "$$0 isn't anything else"
${EndSelect}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Switch}

> Jumps to one of several labels, depending on the value of an expression. Use ${Break} to prevent fall-through to the next ${Case} section.

Jumps to one of several labels, depending on the value of an expression. Use ${Break} to prevent fall-through to the next ${Case} section.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Switch} expression
```

## Example

[Section titled “Example”](#example)

```plaintext
{For} $0 1 10
    ${Switch} $0
        ${Case} "1"
            MessageBox MB_OK "$$0 is 1"
            ${Break}
        ${Case} "2"
            MessageBox MB_OK "$$0 is 2"
            ${Break}
        ${Case2} "3" "5"
            MessageBox MB_OK "$$0 is 3 or 5"
            ${Break}
        ${CaseElse}
            MessageBox MB_OK "$$0 is something else ($0)"
    ${EndSwitch}
${Next}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${Unless}

> Conditionally executes a block of statements, depending on the value of an expression. ${IfNot} and ${Unless} are equivalent and interchangeable, as are…

Conditionally executes a block of statements, depending on the value of an expression. [`${IfNot}`](IfNot.md) and `${Unless}` are equivalent and interchangeable, as are [`${ElseIfNot}`](ElseIfNot.md) and [`${ElseUnless}`](ElseUnless.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${Unless} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Examples

[Section titled “Examples”](#examples)

### Check if condition is met

[Section titled “Check if condition is met”](#check-if-condition-is-met)

```plaintext
StrCpy $0 true


${Unless} $0 == true
    MessageBox MB_OK "It's false"
${EndUnless}


${Unless} $0 != true
    MessageBox MB_OK "It's true (but I'd use $${If} $$0 == true)"
${EndUnless}
```

### Integer tests

[Section titled “Integer tests”](#integer-tests)

```plaintext
${Unless} 1 > 0
    MessageBox MB_OK "This is never true"
${EndUnless}
```

### File conditions

[Section titled “File conditions”](#file-conditions)

```plaintext
${Unless} ${FileExists} $SYSDIR\notepad.exe
    MessageBox MB_OK "Could not find notepad.exe"
${Else}
    Exec $SYSDIR\notepad.exe
${EndUnless}


${Unless} ${FileExists} $PROGAMFILES\*.*
    MessageBox MB_OK "Directory $$PROGRAMFILES doesn't exist"
${EndUnless}
```

### Section test

[Section titled “Section test”](#section-test)

```plaintext
Section "My Section" mySection
    MessageBox MB_OK "Executing section"


    ${Unless} ${SectionIsSelected} ${mySection}
        MessageBox MB_OK "This will never show, dummy!"
    ${EndUnless}
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${While}

> Repeats a block of statements until stopped, or depending on the value of an expression. ${DoWhile} and ${While} are equivalent and interchangeable.

Repeats a block of statements until stopped, or depending on the value of an expression. [`${DoWhile}`](DoWhile.md) and `${While}` are equivalent and interchangeable.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${While} expression
```

The following “expressions” are available:

```plaintext
Standard (built-in) string tests (which are case-insensitive):
     a == b; a != b
Additional case-insensitive string tests (using System.dll):
     a S< b; a S>= b; a S> b; a S<= b
Case-sensitive string tests:
     a S== b; a S!= b
Standard (built-in) signed integer tests:
     a = b; a <> b; a < b; a >= b; a > b; a <= b
Standard (built-in) unsigned integer tests:
     a U< b; a U>= b; a U> b; a U<= b
64-bit integer tests (using System.dll):
    a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
Built-in NSIS flag tests:
    ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
Built-in NSIS other tests:
    ${FileExists} a
Any conditional NSIS instruction test:
    ${Cmd} a
Section flag tests:
    ${SectionIsSelected} a; ${SectionIsSectionGroup} a;
    ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
    ${SectionIsReadOnly} a; ${SectionIsExpanded} a;
    ${SectionIsPartiallySelected} a
```

## Example

[Section titled “Example”](#example)

```plaintext
StrCpy $0 0


${While} $0 > 5
    IntOp $0 $0 + 1
${EndWhile}
```

## Credits

[Section titled “Credits”](#credits)

Written by dselkirk and eccles

# ${MementoSection}

> Replace Section with ${MementoSection} and SectionEnd with ${MementoSectionEnd} for sections that whose state should be remembered by Memento.

Replace [`Section`](../../Commands/Section.md) with `${MementoSection}` and [`SectionEnd`](../../Commands/SectionEnd.md) with [`${MementoSectionEnd}`](MementoSectionEnd.md) for sections that whose state should be remembered by Memento.

For sections that should be unselected by default, use `${MementoSection}`’s brother - [`${MementoUnselectedSection}`](MementoUnselectedSection.md).

Sections that don’t already have an identifier must be assigned one.

Section identifiers must stay the same across

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoSection} [section_name] [section_index_output]
```

## Example

[Section titled “Example”](#example)

```plaintext
!include Memento.nsh


!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProgram


Function .onInit
    ${MementoSectionRestore}
FunctionEnd


Function .onInstSuccess
    ${MementoSectionSave}
FunctionEnd


${MementoSection} "name" "some_id"
    ; some code...
${MementoSectionEnd}


SectionGroup /e group


    ${MementoSection} croc sec_croc
        ; some code...
    ${MementoSectionEnd}


    ${MementoSection} cow sec_cow
        ; some code...
    ${MementoSectionEnd}


SectionGroupEnd


${MementoUnselectedSection} dinosaur sec_dinosaur
    ; some code...
${MementoSectionEnd}


${MementoSectionDone}
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${MementoSectionDone}

> Use ${MementoSectionDone} after the last ${MementoSection}.

Use `${MementoSectionDone}` after the last [`${MementoSection}`](MementoSection.md).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoSectionDone}
```

## Example

[Section titled “Example”](#example)

```plaintext
!include Memento.nsh


!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProgram


Function .onInit
    ${MementoSectionRestore}
FunctionEnd


Function .onInstSuccess
    ${MementoSectionSave}
FunctionEnd


${MementoUnselectedSection} dinosaur sec_dinosaur
    ; some code...
${MementoSectionEnd}


${MementoSectionDone}
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${MementoSectionEnd}

> Replace Section with ${MementoSection} and SectionEnd with ${MementoSectionEnd} for sections that whose state should be remembered by Memento.

Replace [`Section`](../../Commands/Section.md) with `${MementoSection}` and [`SectionEnd`](../../Commands/SectionEnd.md) with [`${MementoSectionEnd}`](MementoSectionEnd.md) for sections that whose state should be remembered by Memento.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoSectionEnd}
```

## Example

[Section titled “Example”](#example)

```plaintext
!include Memento.nsh


!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProgram


Function .onInit
    ${MementoSectionRestore}
FunctionEnd


Function .onInstSuccess
    ${MementoSectionSave}
FunctionEnd


${MementoSection} "name" "some_id"
    ; some code...
${MementoSectionEnd}


${MementoUnselectedSection} dinosaur sec_dinosaur
    ; some code...
${MementoSectionEnd}


${MementoSectionDone}
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${MementoSectionRestore}

> Add a call to ${MementoSectionRestore} to .onInit to restore the state of all sections from the registry.

Add a call to `${MementoSectionRestore}` to [`.onInit`](../../Callbacks/onInit.md) to restore the state of all sections from the registry.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoSectionRestore}
```

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInit
    ${MementoSectionRestore}
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${MementoSectionSave}

> Add a call to ${MementoSectionSave} to .onInstSuccess to save the stateof all sections to the registry.

Add a call to `${MementoSectionSave}` to [`.onInstSuccess`](../../Callbacks/onInstSuccess.md) to save the stateof all sections to the registry.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoSectionSave}
```

## Example

[Section titled “Example”](#example)

```plaintext
Function .onInstSuccess
    ${MementoSectionSave}
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${MementoUnselectedSection}

> Replace Section with ${MementoSection} and SectionEnd with ${MementoSectionEnd} for sections that whose state should be remembered by Memento.

Replace [`Section`](../../Commands/Section.md) with [`${MementoSection}`](MementoSection.md) and [`SectionEnd`](../../Commands/SectionEnd.md) with [`${MementoSectionEnd}`](MementoSectionEnd.md) for sections that whose state should be remembered by Memento.

For sections that should be unselected by default, use [`${MementoSection}`](MementoSection.md)’s brother - `${MementoUnselectedSection}`.

Sections that don’t already have an identifier must be assigned one.

Section identifiers must stay the same across

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${MementoUnselectedSection} [section_name] [section_index_output]
```

## Example

[Section titled “Example”](#example)

```plaintext
!include Memento.nsh


!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\MyProgram


Function .onInit
    ${MementoSectionRestore}
FunctionEnd


Function .onInstSuccess
    ${MementoSectionSave}
FunctionEnd


${MementoUnselectedSection} dinosaur sec_dinosaur
    ; some code...
${MementoSectionEnd}


${MementoSectionDone}
```

## Credits

[Section titled “Credits”](#credits)

Written by [kichik](http://nsis.sourceforge.net/User:Kichik)

# ${StrCase}

> Converts "String" to "Type" Case. Uses LogicLib.

Converts “String” to “Type” Case. Uses [LogicLib](../LogicLib).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String Type(|L|U|T|S|<>)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String to convert to "Type" case.


Type
Type of string case to convert to:


  - "" = Original Case (same as "String")
  - L = Lower Case (this is just an example. a very simple one.)
  - U = Upper Case (THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE.)
  - T = Title Case (This Is Just An Example. A Very Simple One.)
  - S = Sentence Case (This is just an example. A very simple one.)
  - <> = Switch Case (This is just an example. A very simple one.)


Default value is "" (Original Case).
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrCase} $0 '"Você" is "You" in English.' "U"
$0 = '"VOCÊ" IS "YOU" IN ENGLISH.'
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrClb}

> Makes an action with the clipboard depending on value of parameter "Action". Uses LogicLib.

Makes an action with the clipboard depending on value of parameter “Action”. Uses [LogicLib](../LogicLib).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String Action(|>|<|<>)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
String
If "Action" = ">" or "<>" - String to put on the clipboard.


Action
Can be one of the following values:


  - "" = Cleans the clipboard.
  - ">" = Set string to clipboard.
  - "<" = Get string from clipboard.
  - "<>" = Swap string with clipboard's.
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrIOToNSIS}

> Convert "String" from Install Options plugin to be supported by NSIS. Escape, back-slash, carriage return, line feed and tab characters are converted.

Convert “String” from Install Options plugin to be supported by NSIS. Escape, back-slash, carriage return, line feed and tab characters are converted.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String to convert to be supportable for NSIS.
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrIOToNSIS} $0 "\r\n\t\\This is just an example\\"
$0 = "$\r$\n$\t\This is just an example\"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrLoc}

> Searches for "StrToSearchFor" in "String" and returns its location, according to "CounterDirection".

Searches for “StrToSearchFor” in “String” and returns its location, according to “CounterDirection”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String StrToSearchFor CounterDirection(>|<)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search "StrToSearchFor".


StrToSearchFor
String to search in "String".


CounterDirection(>|<)
Direction where the counter increases to. Default is ">".
(> = increases from left to right, < = increases from right to left)
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrLoc} $0 "This is just an example" "just" "<"
$0 = "11"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrNSISToIO}

> Converts "String" from NSIS to be supported by Install Options plugin. Escape, back-slash, carriage return, line feed and tab characters are converted.

Converts “String” from NSIS to be supported by Install Options plugin. Escape, back-slash, carriage return, line feed and tab characters are converted.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String to convert to be supportable for Install Options plugin.
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrNSISToIO} $0 "$\r$\n$\t\This is just an example\"
$0 = "\r\n\t\\This is just an example\\"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrRep}

> Searches for all "StrToReplace" in "String" replacing those with "ReplacementString".

Searches for all “StrToReplace” in “String” replacing those with “ReplacementString”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String StrToReplace ReplacementString
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search "StrToReplace".


StrToReplaceFor
String to search in "String".


StringToBeReplacedWith
String to replace "StringToReplace" when it is found in "String".
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrRep} $0 "This is just an example" "an" "one"
$0 = "This is just one example"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrSort}

> Searches for "CenterStr" in "String", and returns only the value between "LeftStr" and "RightStr", including or not the "CenterStr" using "IncludeCenterStr"…

Searches for “CenterStr” in “String”, and returns only the value between “LeftStr” and “RightStr”, including or not the “CenterStr” using “IncludeCenterStr” and/or the “LeftStr” using “IncludeLeftStr” and “RightStr” using “IncludeRightStr”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String LeftStr CenterStr RightStr IncludeLeftStr(1|0) IncludeCenterStr(1|0) IncludeRightStr(1|0)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search "CenterStr".


LeftStr
The first occurrence of "LeftStr" on the left of "CenterStr".
If it is an empty value, or was not found, will return
everything on the left of "CenterStr".


CenterStr
String to search in "String".


RightStr
The first occurrence of "RightStr" on the right of "CenterStr".
If it is an empty value, or was not found, will return
everything on the right of "CenterStr".


IncludeLeftStr(1|0)
Include or not the "LeftStr" in the result value. Default is 1
(True). (1 = True, 0 = False)


IncludeCenterStr(1|0)
Include or not the "CenterStr" in the result value. Default is 1
(True). (1 = True, 0 = False)


IncludeRightStr(1|0)
Include or not the "RightStr" in the result value. Default is 1
(True). (1 = True, 0 = False)
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrSort} $0 "This is just an example" " just" "" "ple" "0" "0" "0"
$0 = "This is an exam"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrStr}

> Searches for "StrToSearchFor" in "String".

Searches for “StrToSearchFor” in “String”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String StrToSearchFor
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search "StrToSearchFor".


StrToSearchFor
String to search in "String".
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrStr} $0 "This is just an example" "just"
$0 = "just an example"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrStrAdv}

> Searches for "StrToSearchFor" in "String" in the direction specified by "SearchDirection" and looping "Loops" times.

Searches for “StrToSearchFor” in “String” in the direction specified by “SearchDirection” and looping “Loops” times.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String StrToSearchFor SearchDirection(>|<) ResultStrDirection(>|<) DisplayStrToSearch(1|0) Loops CaseSensitive(0|1)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search "StrToSearchFor".


StrToSearchFor
String to search in "String".


SearchDirection (>|<)
Where do you want to direct the search. Default is ">" (to right).
(< = To left, > = To right)


ResultStrDirection (>|<)
Where the result string will be based on in relation of
"StrToSearchFor"
position. Default is ">" (to right). (< = To left, > = To right)


DisplayStrToSearch (1|0)
Display "StrToSearchFor" in the result. Default is "1" (True).
(1 = True, 0 = False)


Loops
Number of times the code will search "StrToSearchFor" in "String" not
including the original execution. Default is "0" (1 code execution).


CaseSensitive(0|1)
If "1" the search will be case-sensitive (differentiates between cases).
If "0" it is case-insensitive (does not differentiate between cases).
Default is "0" (Case-Insensitive).
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrStrAdv} $0 "This IS really just an example" "IS " ">" ">" "0" "0" "1"
$0 = "really just an example"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrTok}

> Returns the part "ResultPart" between two "Separators" inside "String".

Returns the part “ResultPart” between two “Separators” inside “String”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String Separators ResultPart[L] SkipEmptyParts(1|0)
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search for "Separators".


Separators
Characters to find on "String".


ResultPart[L]
The part want to be found on "StrToTokenize" between two "Separators".
Can be any number, starting at 0, and "L" that is the last part.
Default is L (Last part).


SkipEmptyParts(1|0)
Skips empty string parts between two "Separators". Default is 1 (True).
(1 = True, 0 = False)
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrTok} $0 "This is, or is not, just an example" " ," "4" "1"
$0 = "not"


${StrTok} $0 "This is, or is not, just an example" " ," "4" "0"
$0 = "is"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${StrTrimNewLines}

> Deletes unnecessary new lines at end of "String".

Deletes unnecessary new lines at end of “String”.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
ResultVar String
```

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
ResultVar
Destination where result is returned.


String
String where to search unnecessary new lines at end of "String".
```

## Example

[Section titled “Example”](#example)

```plaintext
${StrTrimNewLines} $0 "$\r$\nThis is just an example$\r$\n$\r$\n"
$0 = "$\r$\nThis is just an example"
```

## Credits

[Section titled “Credits”](#credits)

Written by [deguix](http://nsis.sourceforge.net/User:Deguix)

# ${ConfigRead}

> Read value from entry name in config file.

Read value from entry name in config file.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ConfigRead} "[File]" "[Entry]" $var
"[File]"      ; config file
              ;
"[Entry]"     ; entry name
              ;
$var          ; Result:  Value
```

Note:

* Error flag if entry not found
* Error flag if file doesn’t exist

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${ConfigRead} "C:\AUTOEXEC.BAT" "SET winbootdir=" $R0
    ;$R0=C:\WINDOWS
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${ConfigRead} "C:\apache\conf\httpd.conf" "Timeout " $R0
    ;$R0=30
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${ConfigReadS}

> Read value from entry name in config file, case sensitive

Read value from entry name in config file, case sensitive

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ConfigReadS} "[File]" "[Entry]" $var
"[File]"      ; config file
              ;
"[Entry]"     ; entry name
              ;
$var          ; Result:  Value
```

Note:

* Error flag if entry not found
* Error flag if file doesn’t exist

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${ConfigReadS} "C:\AUTOEXEC.BAT" "SET winbootdir=" $R0
    ;$R0=C:\WINDOWS
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${ConfigReadS} "C:\apache\conf\httpd.conf" "Timeout " $R0
    ;$R0=30
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${ConfigWrite}

> Write value from entry name in config file.

Write value from entry name in config file.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ConfigWrite} "[File]" "[Entry]" "[Value]" $var


"[File]"      ; config file
              ;
"[Entry]"     ; entry name
              ;
"[Value]"     ; value name
              ;  if "" then delete Entry
              ;
$var          ; Result:
              ;    $var=CHANGED  Value is written
              ;    $var=DELETED  Entry is deleted
              ;    $var=ADDED    Entry and Value are added
              ;    $var=SAME     Entry and Value already exist
```

Note:

* Error flag if file doesn’t exist
* Error flag if file can’t be opened

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${ConfigWrite} "C:\AUTOEXEC.BAT" "SET winbootdir=" "D:\WINDOWS" $R0
    ;$R0=CHANGED
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${ConfigWrite} "C:\apache\conf\httpd.conf" "Timeout " "30" $R0
    ;$R0=SAME
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${ConfigWrite} "C:\apache\conf\httpd.conf" "Timeout " "" $R0
    ;$R0=DELETED
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${ConfigWriteS}

> Write value from entry name in config file, case sensitive.

Write value from entry name in config file, case sensitive.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${ConfigWriteS} "[File]" "[Entry]" "[Value]" $var


"[File]"      ; config file
              ;
"[Entry]"     ; entry name
              ;
"[Value]"     ; value name
              ;  if "" then delete Entry
              ;
$var          ; Result:
              ;    $var=CHANGED  Value is written
              ;    $var=DELETED  Entry is deleted
              ;    $var=ADDED    Entry and Value are added
              ;    $var=SAME     Entry and Value already exist
```

Note:

* Error flag if file doesn’t exist
* Error flag if file can’t be opened

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${ConfigWriteS} "C:\AUTOEXEC.BAT" "SET winbootdir=" "D:\WINDOWS" $R0
    ;$R0=CHANGED
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${ConfigWriteS} "C:\apache\conf\httpd.conf" "Timeout " "30" $R0
    ;$R0=SAME
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${ConfigWriteS} "C:\apache\conf\httpd.conf" "Timeout " "" $R0
    ;$R0=DELETED
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${FileJoin}

> Join two files in one.

Join two files in one.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${FileJoin} "[File1]" "[File2]" "[File3]"
"[File1]"     ; Input File1
"[File2]"     ; Input File2
"[File3]"     ; Output File3
              ;  If [File3]="" Then add [File2] to [File1]
```

Note:

* Error flag if input files don’t exist
* Error flag if output file path doesn’t exist

## Examples

[Section titled “Examples”](#examples)

### Join a.log + b.log = Z.log

[Section titled “Join a.log + b.log = Z.log”](#join-alog--blog--zlog)

```plaintext
Section
    ${FileJoin} "C:\a.log" "C:\logs\b.log" "C:\Z.log"
SectionEnd
```

### Add a.log + b.log = a.log

[Section titled “Add a.log + b.log = a.log”](#add-alog--blog--alog)

```plaintext
Section
    ${FileJoin} "C:\a.log" "C:\logs\b.log" "C:\a.log"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${FileReadFromEnd}

> Read text file from end line by line.

Read text file from end line by line.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${FileReadFromEnd} "[File]" "Function"


"[File]"      ; Input text file
"Function"    ; Callback function


Function "Function"
    ; $9       current line
    ; $8       current line number
    ; $7       current line negative number


    ; $R0-$R9  are not used (save data in them).
    ; ...


    Push $var      ; If $var="StopFileReadFromEnd"  Then exit from function
FunctionEnd
```

Note:

* Error flag if input file doesn’t exist

## Examples

[Section titled “Examples”](#examples)

### Read and display lines

[Section titled “Read and display lines”](#read-and-display-lines)

```plaintext
Section
    ${FileReadFromEnd} "C:\a.log" "Example1"


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example1
    MessageBox MB_OKCANCEL '"Line"=[$9]$\n   "#"=[$8]$\n  "-#"=[$7]' IDOK +2
    StrCpy $0 StopFileReadFromEnd


    Push $0
FunctionEnd
```

### Reverse text file

[Section titled “Reverse text file”](#reverse-text-file)

```plaintext
Section
    GetTempFileName $R0
    FileOpen $R1 $R0 w
    ${FileReadFromEnd} "C:\a.log" "Example2"
    FileClose $R1


    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    Exec '"notepad.exe" "$R0"'
SectionEnd


Function Example2
    StrCmp $7 -1 0 +5
    StrCpy $1 $9 1 -1
    StrCmp $1 '$\n' +3
    StrCmp $1 '$\r' +2
    StrCpy $9 '$9$\r$\n'


    FileWrite $R1 "$9"


    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${FileRecode}

> Recode text file from DOS to Windows format and vice-versa.

Recode text file from DOS to Windows format and vice-versa.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${FileRecode} "[File]" "[Format]"


"[File]"        ;
                ;
"[Format]"      ; OemToChar   -from DOS to Windows
                ; CharToOem   -from Windows to DOS
```

Note:

* Error flag if file doesn’t exist
* Error flag if syntax error

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${FileRecode} "C:\SCANDISK.LOG" "CharToOem"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${LineFind}

> Find specified lines in text file, and edit or view these lines in callback function.

Find specified lines in text file, and edit or view these lines in callback function.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${LineFind} "[File1]" "[File2|/NUL]" "[LineNumbers]" "Function"


"[File1]"         ; Input text file
                  ;
"[File2|/NUL]"    ; [File2]
                  ;   Output text file
                  ;   If empty then File2=File1
                  ; [/NUL]
                  ;   No output text file (only read File1)
                  ;
"[LineNumbers]"   ; [No|-No|No:No|{No}|{-No}|{No:No}]
                  ;   1:-1     all lines to change (default)
                  ;   2        second line from start
                  ;   -3       third line from end
                  ;   5:9      range of lines from 5 to 9
                  ;   {2}      only second line from start to output
                  ;   {-3}     only third line from end to output
                  ;   {5:9}    only range of lines from 5 to 9 to output
                  ;
"Function"        ; Callback function for specified lines


Function "Function"
    ; $R9       current line
    ; $R8       current line number
    ; $R7       current line negative number
    ; $R6       current range of lines
    ; $R5       handle of a file opened to read
    ; $R4       handle of a file opened to write ($R4="" if "/NUL")


    ; you can use any string functions
    ; $R0-$R3  are not used (save data in them).
    ; ...


    Push $var      ; If $var="StopLineFind"  Then exit from function
                   ; If $var="SkipWrite"     Then skip current line (ignored if "/NUL")
FunctionEnd
```

Note:

* Error flag if input file doesn’t exist
* Error flag if output file path doesn’t exist
* Ranges must be specified on growth (2 4:5 9:-8 -5:-4 -2:-1)
* Output file will not be updated if no changes made.

## Examples:

[Section titled “Examples:”](#examples)

### Delete first two symbols

[Section titled “Delete first two symbols”](#delete-first-two-symbols)

```plaintext
Section
    ${LineFind} "C:\a.log" "C:\a-edited.log" "3:-1" "Example1"
    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example1
    ${TrimNewLines} '$R9' $R9
    StrCpy $R9 $R9 '' 2
    StrCpy $R9 '$R9$\r$\n'
    ;start from 3 line and delete first two symbols


    Push $0
FunctionEnd
```

### Show changed lines

[Section titled “Show changed lines”](#show-changed-lines)

```plaintext
Section
    ${LineFind} "C:\a.log" "a.log" "{5:12 15 -6:-5 -1}" "Example2"
    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example2
    ${TrimNewLines} '$R9' $R9
    StrCpy $R9 "$R9   ~Changed line ($R8)~$\r$\n"


    Push $0
FunctionEnd
```

### Delete lines

[Section titled “Delete lines”](#delete-lines)

```plaintext
Section
    ${LineFind} "C:\a.log" "\logs\a.log" "2:3 10:-5 -3:-2" "Example3"
    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example3
    StrCpy $0 SkipWrite


    Push $0
FunctionEnd
```

### Insert lines

[Section titled “Insert lines”](#insert-lines)

```plaintext
Section
    ${LineFind} "C:\a.log" "" "10" "Example4
    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example4
    FileWrite $R4 "---First Line---$\r$\n"
    FileWrite $R4 "---Second Line ...---$\r$\n"


    Push $0
FunctionEnd
```

### Replace in file with count of changes - “WordFunc.nsh” required

[Section titled “Replace in file with count of changes - “WordFunc.nsh” required”](#replace-in-file-with-count-of-changes---wordfuncnsh-required)

```plaintext
!include "WordFunc.nsh"


Section
    StrCpy $R0 0
    ${LineFind} "C:\a.log" "C:\logs\a.log" "1:-1" "Example5"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    MessageBox MB_OK "Changed lines=$R0"
SectionEnd


Function Example5
    StrCpy $1 $R9


    ${WordReplace} '$R9' ' ' '_' '+*' $R9


    StrCmp $1 $R9 +2
    IntOp $R0 $R0 + 1
    ;$R0   count of changed lines


    Push $0
FunctionEnd
```

### Line string to cut or delete

[Section titled “Line string to cut or delete”](#line-string-to-cut-or-delete)

```plaintext
Section
    ${LineFind} "\a.log" "C:\logs\a.log" "" "Example6"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2
    MessageBox MB_OK "Processed lines=$R1:$R2"
SectionEnd


Function Example6
    ;(Cut lines from a line to another line (also including that line))
    StrCmp $R0 finish stop
    StrCmp $R0 start finish
    StrCmp $R9 'Start Line$\r$\n' 0 skip
    StrCpy $R0 start
    StrCpy $R1 $R8
    goto code
    finish:
    StrCmp $R9 'Finish Line$\r$\n' 0 code
    StrCpy $R0 finish
    StrCpy $R2 $R8
    goto code
    skip:
    StrCpy $0 SkipWrite
    goto output
    stop:
    StrCpy $0 StopLineFind
    goto output


    ;;(Delete lines from a line to another line (also including that line))
    ; StrCmp $R0 finish code
    ; StrCmp $R0 start finish
    ; StrCmp $R9 'Start Line$\r$\n' 0 code
    ; StrCpy $R0 start
    ; StrCpy $R1 $R8
    ; goto skip
    ; finish:
    ; StrCmp $R9 'Finish Line$\r$\n' 0 skip
    ; StrCpy $R0 finish
    ; StrCpy $R2 $R8
    ; skip:
    ; StrCpy $0 SkipWrite
    ; goto output


    code:
    ;...


    output:
    Push $0
FunctionEnd
```

### Read lines

[Section titled “Read lines”](#read-lines)

```plaintext
Section
    ${LineFind} "C:\a.log" "/NUL" "1:-1" "Example7"
    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example7
    MessageBox MB_OKCANCEL '$$R9  "Line"=[$R9]$\n$$R8     "#" =[$R8]' IDOK +2
    StrCpy $0 StopLineFind


    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${LineRead}

> Get line in file specified with number.

Get line in file specified with number.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${LineRead} "[File]" "[LineNumber]" $var


"[File]"         ; Input text file
                 ;
"[LineNumber]"   ; [No|-No]
                 ;   3    line number from start
                 ;   -5   line number from end
                 ;
$var             ; Result: Line
```

Note:

* Error flag if input file doesn’t exist
* Error flag if line number not found

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${LineRead} "C:\a.log" "-1" $R0
    ; $R0="Last line$\r$\n"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${LineSum}

> Get sum of lines in text file.

Get sum of lines in text file.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${LineSum} "[File]" $var


"[File]"      ; Input file
$var          ; Result: Sum of lines
```

Note:

* Error flag if input file doesn’t exist

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${LineSum} "C:\a.log" $R0
    ; $R0="54"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${TextCompare}

> Compare two text files.

Compare two text files.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${TextCompare} "[File1]" "[File2]" "[Option]" "Function"


"[File1]"     ; File1      Compare these lines
"[File2]"     ; File2      Compare with these lines
"[Options]"   ; (line-by-line):
              ; FastDiff   Compare line N (File1) with line N (File2)
              ;            Call function if Different lines found
              ; FastEqual  Compare line N (File1) with line N (File2)
              ;            Call function if Equal lines found
              ; (line number independent):
              ; SlowDiff   Compare line N (File1) with all lines (File2)
              ;            Call function if line N (File1) Different
              ; SlowEqual  Compare line N (File1) with all lines (File2)
              ;            Call function if line N (File1) Equal
"Function"    ; Callback function


Function "Function"
    ; $9    "Line File1"
    ; $8    "Line number"
    ; $7    "Line File2"  (empty if SlowDiff)
    ; $6    "Line number" (empty if SlowDiff)


    ; $R0-$R9  are not used (save data in them).
    ; ...


    Push $var    ; If $var="StopTextCompare"  Then exit from function
FunctionEnd
```

Note:

* Error flag if File1 or File2 doesn’t exist
* Error flag if syntax error

## Examples

[Section titled “Examples”](#examples)

### Different or Equal

[Section titled “Different or Equal”](#different-or-equal)

```plaintext
Section
    StrCpy $R0 ''
    ${TextCompare} "C:\1.txt" "C:\2.txt" "FastDiff" "Example1"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +4


    StrCmp $R0 NotEqual 0 +2
    MessageBox MB_OK "Files differ" IDOK +2
    MessageBox MB_OK "Files identical"
SectionEnd


Function Example1
    StrCpy $R0 NotEqual
    StrCpy $0 StopTextCompare


    Push $0
FunctionEnd
```

### Compare line-by-line - Different

[Section titled “Compare line-by-line - Different”](#compare-line-by-line---different)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompare} "$R0" "$R1" "FastDiff" "Example2"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example2
    FileWrite $R3 '$8=$9'
    FileWrite $R3 '$6=$7$\r$\n'


    Push $0
FunctionEnd
```

### Compare line-by-line - Equal

[Section titled “Compare line-by-line - Equal”](#compare-line-by-line---equal)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompare} "$R0" "$R1" "FastEqual" "Example3"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example3
    FileWrite $R3 '$8|$6=$9'


    Push $0
FunctionEnd
```

### Compare all lines - Different

[Section titled “Compare all lines - Different”](#compare-all-lines---different)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompare} "$R0" "$R1" "SlowDiff" "Example4"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK end


    FileWrite $R3 "$\r$\n$R1 | $R0$\r$\n"
    ${TextCompare} "$R1" "$R0" "SlowDiff" "Example4"
    FileClose $R3
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK end


    Exec "notepad.exe $R2"


    end:
FunctionEnd


Function Example4
    FileWrite $R3 '$8=$9'


    Push $0
FunctionEnd
```

### Compare all lines - Equal

[Section titled “Compare all lines - Equal”](#compare-all-lines---equal)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompare} "$R0" "$R1" "SlowEqual" "Example5"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example5
    FileWrite $R3 '$8|$6=$9'


    Push $0
FunctionEnd
```

### Show variables

[Section titled “Show variables”](#show-variables)

```plaintext
Section
    ${TextCompare} "C:\1.txt" "C:\2.txt" "FastDiff" "Example6"


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example6
    MessageBox MB_OKCANCEL '$$9    "Line File1" =[$9]$\n$$8    "Line #"      =[$8]$\n$$7    "Line File2" =[$7]$\n$$6    "Line #"      =[$6]' IDOK +2
    StrCpy $0 StopTextCompare


    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${TextCompareS}

> Compare two text files, case sensitive

Compare two text files, case sensitive

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${TextCompareS} "[File1]" "[File2]" "[Option]" "Function"


"[File1]"     ; File1      Compare these lines
"[File2]"     ; File2      Compare with these lines
"[Options]"   ; (line-by-line):
              ; FastDiff   Compare line N (File1) with line N (File2)
              ;            Call function if Different lines found
              ; FastEqual  Compare line N (File1) with line N (File2)
              ;            Call function if Equal lines found
              ; (line number independent):
              ; SlowDiff   Compare line N (File1) with all lines (File2)
              ;            Call function if line N (File1) Different
              ; SlowEqual  Compare line N (File1) with all lines (File2)
              ;            Call function if line N (File1) Equal
"Function"    ; Callback function


Function "Function"
    ; $9    "Line File1"
    ; $8    "Line number"
    ; $7    "Line File2"  (empty if SlowDiff)
    ; $6    "Line number" (empty if SlowDiff)


    ; $R0-$R9  are not used (save data in them).
    ; ...


    Push $var    ; If $var="StopTextCompare"  Then exit from function
FunctionEnd
```

Note:

* Error flag if File1 or File2 doesn’t exist
* Error flag if syntax error

## Examples

[Section titled “Examples”](#examples)

### Different or Equal

[Section titled “Different or Equal”](#different-or-equal)

```plaintext
Section
    StrCpy $R0 ''
    ${TextCompareS} "C:\1.txt" "C:\2.txt" "FastDiff" "Example1"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +4


    StrCmp $R0 NotEqual 0 +2
    MessageBox MB_OK "Files differ" IDOK +2
    MessageBox MB_OK "Files identical"
SectionEnd


Function Example1
    StrCpy $R0 NotEqual
    StrCpy $0 StopTextCompare


    Push $0
FunctionEnd
```

### Compare line-by-line - Different

[Section titled “Compare line-by-line - Different”](#compare-line-by-line---different)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompareS} "$R0" "$R1" "FastDiff" "Example2"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example2
    FileWrite $R3 '$8=$9'
    FileWrite $R3 '$6=$7$\r$\n'


    Push $0
FunctionEnd
```

### Compare line-by-line - Equal

[Section titled “Compare line-by-line - Equal”](#compare-line-by-line---equal)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompareS} "$R0" "$R1" "FastEqual" "Example3"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example3
    FileWrite $R3 '$8|$6=$9'


    Push $0
FunctionEnd
```

### Compare all lines - Different

[Section titled “Compare all lines - Different”](#compare-all-lines---different)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompareS} "$R0" "$R1" "SlowDiff" "Example4"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK end


    FileWrite $R3 "$\r$\n$R1 | $R0$\r$\n"
    ${TextCompareS} "$R1" "$R0" "SlowDiff" "Example4"
    FileClose $R3
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK end


    Exec "notepad.exe $R2"


    end:
FunctionEnd


Function Example4
    FileWrite $R3 '$8=$9'


    Push $0
FunctionEnd
```

### Compare all lines - Equal

[Section titled “Compare all lines - Equal”](#compare-all-lines---equal)

```plaintext
Section
    StrCpy $R0 'Text1.txt'
    StrCpy $R1 'Text2.txt'


    GetTempFileName $R2
    FileOpen $R3 $R2 w
    FileWrite $R3 "$R0 | $R1$\r$\n"
    ${TextCompareS} "$R0" "$R1" "SlowEqual" "Example5"
    IfErrors 0 +2
    MessageBox MB_OK "Error" IDOK +2


    Exec "notepad.exe $R2"
FunctionEnd


Function Example5
    FileWrite $R3 '$8|$6=$9'


    Push $0
FunctionEnd
```

### Show variables

[Section titled “Show variables”](#show-variables)

```plaintext
Section
    ${TextCompareS} "C:\1.txt" "C:\2.txt" "FastDiff" "Example6"


    IfErrors 0 +2
    MessageBox MB_OK "Error"
SectionEnd


Function Example6
    MessageBox MB_OKCANCEL '$$9    "Line File1" =[$9]$\n$$8    "Line #"      =[$8]$\n$$7    "Line File2" =[$7]$\n$$6    "Line #"      =[$6]' IDOK +2
    StrCpy $0 StopTextCompare


    Push $0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${TrimNewLines}

> Trim newlines in a string.

Trim newlines in a string.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${TrimNewLines} "[string]" $var


"[string]"    ; Input string
$var          ; Result: String without '$\r' and '$\n' at the end
```

Note:

* Error flag if file doesn’t exist
* Error flag if syntax error

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${TrimNewLines} "Text line$\r$\n" $R0
    ; $R0="Text line"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${AtLeastServicePack}

> Checks if the installer is running on Windows service pack version at least as specified.

Checks if the installer is running on Windows service pack version at least as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastServicePack} service_pack_version
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinXP}
${AndIf} ${AtLeastServicePack} 1
    DetailPrint "Windows XP with SP1 (or higher)"
${Else}
    DetailPrint "Not Windows XP, or no service pack installed"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin10}

> Checks if the installer is running on Windows 10.

Checks if the installer is running on Windows 10.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin10}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin10}
    DetailPrint "Windows 10 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0b2

# ${AtLeastWin11}

> Checks if the installer is running on Windows 11.

Checks if the installer is running on Windows 11.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin11}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin11}
    DetailPrint "Windows 11 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.09

# ${AtLeastWin2000}

> Checks if the installer is running on Windows 2000.

Checks if the installer is running on Windows 2000.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin2000}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin2000}
    DetailPrint "Windows 2000 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin2003}

> Checks if the installer is running on Windows Server 2003.

Checks if the installer is running on Windows Server 2003.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin2003}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin2003}
    DetailPrint "Windows Server 2003 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin2008}

> Checks if the installer is running on Windows Server 2008.

Checks if the installer is running on Windows Server 2008.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin2008}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin2008}
    DetailPrint "Windows Server 2008 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin2008R2}

> Checks if the installer is running on Windows Server 2008 R2.

Checks if the installer is running on Windows Server 2008 R2.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin2008R2}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin2008R2}
    DetailPrint "Windows Server 2008 R2 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin7}

> Checks if the installer is running on Windows 7.

Checks if the installer is running on Windows 7.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin7}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin7}
    DetailPrint "Windows 7 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin8}

> Checks if the installer is running on Windows 8.

Checks if the installer is running on Windows 8.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin8}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin8}
    DetailPrint "Windows 8 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin8.1}

> Checks if the installer is running on Windows 8.1.

Checks if the installer is running on Windows 8.1.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin8.1}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin8.1}
    DetailPrint "Windows 8.1 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0a2

# ${AtLeastWin95}

> Checks if the installer is running on Windows 95.

Checks if the installer is running on Windows 95.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin95}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin95}
    DetailPrint "Windows 95 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWin98}

> Checks if the installer is running on Windows 98.

Checks if the installer is running on Windows 98.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWin98}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWin98}
    DetailPrint "Windows 98 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWinME}

> Checks if the installer is running on Windows ME.

Checks if the installer is running on Windows ME.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWinME}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWinME}
    DetailPrint "Windows ME or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWinNT4}

> Checks if the installer is running on Windows NT4.

Checks if the installer is running on Windows NT4.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWinNT4}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWinNT4}
    DetailPrint "Windows NT 4 or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWinVista}

> Checks if the installer is running on Windows Vista.

Checks if the installer is running on Windows Vista.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWinVista}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWinVista}
    DetailPrint "Windows Vista or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtLeastWinXP}

> Checks if the installer is running on Windows XP.

Checks if the installer is running on Windows XP.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtLeastWinXP}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtLeastWinXP}
    DetailPrint "Windows XP or higher"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostServicePack}

> Checks if the installer is running on Windows service version pack at most as specified.

Checks if the installer is running on Windows service version pack at most as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostServicePack} service_pack_version
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
    DetailPrint "Windows XP with SP2 (or lower)"
${Else}
    DetailPrint "Not Windows XP, or higher service pack installed"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin10}

> Checks if the installer is running on Windows 10 at most.

Checks if the installer is running on Windows 10 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin10}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin10}
    DetailPrint "Windows 10 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0b2

# ${AtMostWin11}

> Checks if the installer is running on Windows 11 at most.

Checks if the installer is running on Windows 11 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin11}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin11}
    DetailPrint "Windows 11 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.09

# ${AtMostWin2000}

> Checks if the installer is running on Windows 2000 at most.

Checks if the installer is running on Windows 2000 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2000}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2000}
    DetailPrint "Windows 2000 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin2003}

> Checks if the installer is running on Windows Server 2003 at most.

Checks if the installer is running on Windows Server 2003 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2003}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2003}
    DetailPrint "Windows Server 2003 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin2008}

> Checks if the installer is running on Windows Server 2008 at most.

Checks if the installer is running on Windows Server 2008 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2008}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2008}
    DetailPrint "Windows Server 2008 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin2008R2}

> Checks if the installer is running on Windows Server 2008 R2 at most.

Checks if the installer is running on Windows Server 2008 R2 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2008R2}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2008R2}
    DetailPrint "Windows Server 2008 R2 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin2012}

> Checks if the installer is running on Windows Server 2012 at most.

Checks if the installer is running on Windows Server 2012 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2012}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2012}
    DetailPrint "Windows Server 2012 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin2012R2}

> Checks if the installer is running on Windows Server 2012 R2 at most.

Checks if the installer is running on Windows Server 2012 R2 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin2012R2}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin2012R2}
    DetailPrint "Windows Server 2012 R2 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin7}

> Checks if the installer is running on Windows 7 at most.

Checks if the installer is running on Windows 7 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin7}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin7}
    DetailPrint "Windows 7 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin8}

> Checks if the installer is running on Windows 8 at most.

Checks if the installer is running on Windows 8 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin8}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin8}
    DetailPrint "Windows 8 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin8.1}

> Checks if the installer is running on Windows 8.1 at most.

Checks if the installer is running on Windows 8.1 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin8.1}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin8.1}
    DetailPrint "Windows 8.1 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0a2

# ${AtMostWin95}

> Checks if the installer is running on Windows 95 at most.

Checks if the installer is running on Windows 95 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin95}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin95}
    DetailPrint "Windows 95 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWin98}

> Checks if the installer is running on Windows 98 at most.

Checks if the installer is running on Windows 98 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWin98}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWin98}
    DetailPrint "Windows 98 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWinME}

> Checks if the installer is running on Windows ME at most.

Checks if the installer is running on Windows ME at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWinME}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWinME}
    DetailPrint "Windows ME or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWinNT4}

> Checks if the installer is running on Windows NT4 at most.

Checks if the installer is running on Windows NT4 at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWinNT4}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWinNT4}
    DetailPrint "Windows NT4 or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWinVista}

> Checks if the installer is running on Windows Vista at most.

Checks if the installer is running on Windows Vista at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWinVista}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWinVista}
    DetailPrint "Windows Vista or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${AtMostWinXP}

> Checks if the installer is running on Windows XP at most.

Checks if the installer is running on Windows XP at most.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${AtMostWinXP}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${AtMostWinXP}
    DetailPrint "Windows XP or lower"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsDomainController}

> Checks if the server is a domain controller

Checks if the server is a domain controller

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsDomainController}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsDomainController}
    DetailPrint "Running on a domain controller."
${Else}
    DetailPrint "Not running on a domain controller."
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsNT}

> Checks if the installer is running on Windows NT family (NT4, 2000, XP, etc.)

Checks if the installer is running on Windows NT family (NT4, 2000, XP, etc.)

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsNT}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsNT}
    DetailPrint "Running on NT. Installing Unicode enabled application."
${Else}
    DetailPrint "Not running on NT. Installing ANSI application."
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsServerOS}

> Checks if the installer is running on a server version of Windows (NT4, 2003, 2008, etc.)

Checks if the installer is running on a server version of Windows (NT4, 2003, 2008, etc.)

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsServerOS}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsServerOS}
    DetailPrint "Running on Windows Server."
${Else}
    DetailPrint "Not running on Windows Server."
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsServicePack}

> Checks if the installer is running on Windows service pack version exactly as specified.

Checks if the installer is running on Windows service pack version exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsServicePack} service_pack_version
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinXP}
${AndIf} ${IsServicePack} 2
    DetailPrint "Windows XP with SP2"
${Else}
    DetailPrint "Not Windows XP, or different service pack installed"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin10}

> Checks if the installer is running on Windows 10 exactly as specified.

Checks if the installer is running on Windows 10 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin10}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin10}
    DetailPrint "Running on Windows 10"
${Else}
    DetailPrint "Not running on Windows 10"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0b2

# ${IsWin11}

> Checks if the installer is running on Windows 11 exactly as specified.

Checks if the installer is running on Windows 11 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin11}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin11}
    DetailPrint "Running on Windows 11"
${Else}
    DetailPrint "Not running on Windows 11"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.09

# ${IsWin2000}

> Checks if the installer is running on Windows 2000 exactly as specified.

Checks if the installer is running on Windows 2000 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2000}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2000}
    DetailPrint "Running on Windows 2000"
${Else}
    DetailPrint "Not running on Windows 2000"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin2003}

> Checks if the installer is running on Windows Server 2003 exactly as specified.

Checks if the installer is running on Windows Server 2003 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2003}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2003}
    DetailPrint "Running on Windows Server 2003"
${Else}
    DetailPrint "Not running on Windows Server 2003"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin2008}

> Checks if the installer is running on Windows Server 2008 exactly as specified.

Checks if the installer is running on Windows Server 2008 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2008}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2008}
    DetailPrint "Running on Windows Server 2008"
${Else}
    DetailPrint "Not running on Windows Server 2008"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin2008R2}

> Checks if the installer is running on Windows Server 2008 R2 exactly as specified.

Checks if the installer is running on Windows Server 2008 R2 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2008R2}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2008R2}
    DetailPrint "Running on Windows Server 2008 R2"
${Else}
    DetailPrint "Not running on Windows Server 2008 R2"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin2012}

> Checks if the installer is running on Windows Server 2012 exactly as specified.

Checks if the installer is running on Windows Server 2012 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2012}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2012}
    DetailPrint "Running on Windows Server 2012"
${Else}
    DetailPrint "Not running on Windows Server 2012"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin2012R2}

> Checks if the installer is running on Windows Server 2012 R2 exactly as specified.

Checks if the installer is running on Windows Server 2012 R2 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin2012R2}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin2012R2}
    DetailPrint "Running on Windows Server 2012 R2"
${Else}
    DetailPrint "Not running on Windows Server 2012 R2"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin7}

> Checks if the installer is running on Windows 7 exactly as specified.

Checks if the installer is running on Windows 7 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin7}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin7}
    DetailPrint "Running on Windows 7"
${Else}
    DetailPrint "Not running on Windows 7"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin8}

> Checks if the installer is running on Windows 8 exactly as specified.

Checks if the installer is running on Windows 8 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin8}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin8}
    DetailPrint "Running on Windows 8"
${Else}
    DetailPrint "Not running on Windows 8"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin8.1}

> Checks if the installer is running on Windows 8.1 exactly as specified.

Checks if the installer is running on Windows 8.1 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin8.1}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin8.1}
    DetailPrint "Running on Windows 8.1"
${Else}
    DetailPrint "Not running on Windows 8.1"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

## History

[Section titled “History”](#history)

Added in NSIS v3.0a2

# ${IsWin95}

> Checks if the installer is running on Windows 95 exactly as specified.

Checks if the installer is running on Windows 95 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin95}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin95}
    DetailPrint "Running on Windows 95"
${Else}
    DetailPrint "Not running on Windows 95"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWin98}

> Checks if the installer is running on Windows 98 exactly as specified.

Checks if the installer is running on Windows 98 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWin98}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWin98}
    DetailPrint "Running on Windows 98"
${Else}
    DetailPrint "Not running on Windows 98"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWinME}

> Checks if the installer is running on Windows ME exactly as specified.

Checks if the installer is running on Windows ME exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWinME}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinME}
    DetailPrint "Running on Windows ME"
${Else}
    DetailPrint "Not running on Windows ME"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWinNT4}

> Checks if the installer is running on Windows NT4 exactly as specified.

Checks if the installer is running on Windows NT4 exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWinNT4}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinNT4}
    DetailPrint "Running on Windows NT4"
${Else}
    DetailPrint "Not running on Windows NT4"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWinVista}

> Checks if the installer is running on Windows Vista exactly as specified.

Checks if the installer is running on Windows Vista exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWinVista}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinVista}
    DetailPrint "Running on Windows Vista"
${Else}
    DetailPrint "Not running on Windows Vista"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWinXP}

> Checks if the installer is running on Windows XP exactly as specified.

Checks if the installer is running on Windows XP exactly as specified.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWinXP}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWinXP}
    DetailPrint "Running on Windows XP"
${Else}
    DetailPrint "Not running  Windows XP"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${StrFilter}

> Note:

* Convert string to uppercase or lowercase.
* Set symbol filter.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${StrFilter} "[string]" "[options]" "[symbols1]" "[symbols2]" $var


"[string]"       ;[string]
                 ;  input string
                 ;
"[options]"      ;[+|-][1|2|3|12|23|31][eng|rus]
                 ;  +   : convert string to uppercase
                 ;  -   : convert string to lowercase
                 ;  1   : only Digits
                 ;  2   : only Letters
                 ;  3   : only Special
                 ;  12  : only Digits  + Letters
                 ;  23  : only Letters + Special
                 ;  31  : only Special + Digits
                 ;  eng : English symbols (default)
                 ;  rus : Russian symbols
                 ;
"[symbols1]"     ;[symbols1]
                 ;  symbols include (not changeable)
                 ;
"[symbols2]"     ;[symbols2]
                 ;  symbols exclude
                 ;
$var             ;output (result)
```

Note:

* Error flag if syntax error
* Same symbol to include & to exclude = to exclude

## Examples

[Section titled “Examples”](#examples)

### UpperCas

[Section titled “UpperCas”](#uppercas)

```plaintext
Section
    ${StrFilter} "123abc 456DEF 7890|%#" "+" "" "" $R0
    ; $R0="123ABC 456DEF 7890|%#"
SectionEnd
```

### LowerCase

[Section titled “LowerCase”](#lowercase)

```plaintext
Section
    ${StrFilter} "123abc 456DEF 7890|%#" "-" "ef" "" $R0
    ; $R0="123abc 456dEF 7890|%#"
SectionEnd
```

### Filter 1

[Section titled “Filter 1”](#filter-1)

```plaintext
Section
    ${StrFilter} "123abc 456DEF 7890|%#" "2" "|%" "" $R0
    ; $R0="abcDEF|%"       ;only Letters + |%
SectionEnd
```

### Filter 2

[Section titled “Filter 2”](#filter-2)

```plaintext
Section
    ${StrFilter} "123abc 456DEF 7890|%#" "13" "af" "4590" $R0
    ; $R0="123a 6F 78|%#"  ;only Digits + Special + af - 4590
SectionEnd
```

### Filter 3

[Section titled “Filter 3”](#filter-3)

```plaintext
Section
    ${StrFilter} "123abc 456DEF 7890|%#" "+12" "b" "def" $R0
    ; $R0="123AbC4567890"  ;only Digits + Letters + b - def
SectionEnd
```

### Filter 4

[Section titled “Filter 4”](#filter-4)

```plaintext
Section
    ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "+12rus" "ä" "ãå" $R0
    ; $R0="123ÀÁÂ456ä7890"  ;only Digits + Letters + ä - ãå
SectionEnd
```

### English + Russian Letters

[Section titled “English + Russian Letters”](#english--russian-letters)

```plaintext
Section
    ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "2rus" "" "" $R0
    ; $R0="ÀÁÂãäå"        ;only Russian Letters
    ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "2" "$R0" "" $R0
    ; $R0="abcÀÁÂDEFãäå"  ;only English + Russian Letters
SectionEnd
```

### Word Capitalize

[Section titled “Word Capitalize”](#word-capitalize)

```plaintext
Section
    Push "_01-PERPETUOUS_DREAMER__-__THE_SOUND_OF_GOODBYE_(ORIG._MIX).MP3_"
    Call Capitalize
    Pop $R0
    ; $R0="_01-Perpetuous_Dreamer__-__The_Sound_Of_Goodbye_(Orig._Mix).mp3_"


    ${WordReplace} "$R0" "_" " " "+*" $R0
    ; $R0=" 01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3 "


    ${WordReplace} "$R0" " " "" "{}" $R0
    ; $R0="01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3"
SectionEnd


Function Capitalize
    Exch $R0
    Push $0
    Push $1
    Push $2


    ${StrFilter} '$R0' '-eng' '' '' $R0
    ${StrFilter} '$R0' '-rus' '' '' $R0


    StrCpy $0 0


    loop:
    IntOp $0 $0 + 1
    StrCpy $1 $R0 1 $0
    StrCmp $1 '' end
    StrCmp $1 ' ' +5
    StrCmp $1 '_' +4
    StrCmp $1 '-' +3
    StrCmp $1 '(' +2
    StrCmp $1 '[' 0 loop
    IntOp $0 $0 + 1
    StrCpy $1 $R0 1 $0
    StrCmp $1 '' end


    ${StrFilter} '$1' '+eng' '' '' $1
    ${StrFilter} '$1' '+rus' '' '' $1


    StrCpy $2 $R0 $0
    IntOp $0 $0 + 1
    StrCpy $R0 $R0 '' $0
    IntOp $0 $0 - 2
    StrCpy $R0 '$2$1$R0'
    goto loop


    end:
    Pop $2
    Pop $1
    Pop $0
    Exch $R0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${VersionCompare}

> Note:

* Convert string to uppercase or lowercase.
* Set symbol filter.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${StrFilterS} "[string]" "[options]" "[symbols1]" "[symbols2]" $var


"[string]"       ;[string]
                 ;  input string
                 ;
"[options]"      ;[+|-][1|2|3|12|23|31][eng|rus]
                 ;  +   : convert string to uppercase
                 ;  -   : convert string to lowercase
                 ;  1   : only Digits
                 ;  2   : only Letters
                 ;  3   : only Special
                 ;  12  : only Digits  + Letters
                 ;  23  : only Letters + Special
                 ;  31  : only Special + Digits
                 ;  eng : English symbols (default)
                 ;  rus : Russian symbols
                 ;
"[symbols1]"     ;[symbols1]
                 ;  symbols include (not changeable)
                 ;
"[symbols2]"     ;[symbols2]
                 ;  symbols exclude
                 ;
$var             ;output (result)
```

Note:

* Error flag if syntax error
* Same symbol to include & to exclude = to exclude

## Examples

[Section titled “Examples”](#examples)

### UpperCase

[Section titled “UpperCase”](#uppercase)

```plaintext
Section
    ${StrFilterS} "123abc 456DEF 7890|%#" "+" "" "" $R0
    ; $R0="123ABC 456DEF 7890|%#"
SectionEnd
```

### LowerCase

[Section titled “LowerCase”](#lowercase)

```plaintext
Section
    ${StrFilterS} "123abc 456DEF 7890|%#" "-" "ef" "" $R0
    ; $R0="123abc 456dEF 7890|%#"
SectionEnd
```

### Filter 1

[Section titled “Filter 1”](#filter-1)

```plaintext
Section
    ${StrFilterS} "123abc 456DEF 7890|%#" "2" "|%" "" $R0
    ; $R0="abcDEF|%"       ;only Letters + |%
SectionEnd
```

### Filter 2

[Section titled “Filter 2”](#filter-2)

```plaintext
Section
    ${StrFilterS} "123abc 456DEF 7890|%#" "13" "af" "4590" $R0
    ; $R0="123a 6F 78|%#"  ;only Digits + Special + af - 4590
SectionEnd
```

### Filter 3

[Section titled “Filter 3”](#filter-3)

```plaintext
Section
    ${StrFilterS} "123abc 456DEF 7890|%#" "+12" "b" "def" $R0
    ; $R0="123AbC4567890"  ;only Digits + Letters + b - def
SectionEnd
```

### Filter 4

[Section titled “Filter 4”](#filter-4)

```plaintext
Section
    ${StrFilterS} "123abcÀÁÂ 456DEFãäå 7890|%#" "+12rus" "ä" "ãå" $R0
    ; $R0="123ÀÁÂ456ä7890"  ;only Digits + Letters + ä - ãå
SectionEnd
```

### English + Russian Letters

[Section titled “English + Russian Letters”](#english--russian-letters)

```plaintext
Section
    ${StrFilterS} "123abcÀÁÂ 456DEFãäå 7890|%#" "2rus" "" "" $R0
    ; $R0="ÀÁÂãäå"        ;only Russian Letters
    ${StrFilterS} "123abcÀÁÂ 456DEFãäå 7890|%#" "2" "$R0" "" $R0
    ; $R0="abcÀÁÂDEFãäå"  ;only English + Russian Letters
SectionEnd
```

### Word Capitalize

[Section titled “Word Capitalize”](#word-capitalize)

```plaintext
Section
    Push "_01-PERPETUOUS_DREAMER__-__THE_SOUND_OF_GOODBYE_(ORIG._MIX).MP3_"
    Call Capitalize
    Pop $R0
    ; $R0="_01-Perpetuous_Dreamer__-__The_Sound_Of_Goodbye_(Orig._Mix).mp3_"


    ${WordReplace} "$R0" "_" " " "+*" $R0
    ; $R0=" 01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3 "


    ${WordReplace} "$R0" " " "" "{}" $R0
    ; $R0="01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3"
SectionEnd


Function Capitalize
    Exch $R0
    Push $0
    Push $1
    Push $2


    ${StrFilterS} '$R0' '-eng' '' '' $R0
    ${StrFilterS} '$R0' '-rus' '' '' $R0


    StrCpy $0 0


    loop:
    IntOp $0 $0 + 1
    StrCpy $1 $R0 1 $0
    StrCmp $1 '' end
    StrCmp $1 ' ' +5
    StrCmp $1 '_' +4
    StrCmp $1 '-' +3
    StrCmp $1 '(' +2
    StrCmp $1 '[' 0 loop
    IntOp $0 $0 + 1
    StrCpy $1 $R0 1 $0
    StrCmp $1 '' end


    ${StrFilterS} '$1' '+eng' '' '' $1
    ${StrFilterS} '$1' '+rus' '' '' $1


    StrCpy $2 $R0 $0
    IntOp $0 $0 + 1
    StrCpy $R0 $R0 '' $0
    IntOp $0 $0 - 2
    StrCpy $R0 '$2$1$R0'
    goto loop


    end:
    Pop $2
    Pop $1
    Pop $0
    Exch $R0
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${VersionCompare}

> Compare version numbers.

Compare version numbers.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${VersionCompare} "[Version1]" "[Version2]" $var


"[Version1]"        ; First version
"[Version2]"        ; Second version
$var                ; Result:
                    ;    $var=0  Versions are equal
                    ;    $var=1  Version1 is newer
                    ;    $var=2  Version2 is newer
```

## Example

[Section titled “Example”](#example)

```plaintext
Section
    ${VersionCompare} "1.1.1.9" "1.1.1.01" $R0
    ; $R0="1"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${VersionConvert}

> Convert version in the numerical format which can be compared.

Convert version in the numerical format which can be compared.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${VersionConvert} "[Version]" "[CharList]" $var


"[Version]"         ; Version
                    ;
"[CharList]"        ; List of characters, which will be replaced by numbers
                    ; "abcdefghijklmnopqrstuvwxyz" (default)
                    ;
$var                ; Result: converted version
```

Note:

* Converted letters are separated with dot
* If character is non-digit and not in list then it will be converted to dot

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${VersionConvert} "9.0a" "" $R0
    ; $R0="9.0.01"


    ${VersionConvert} "9.0c" "" $R1
    ; $R1="9.0.03"


    ${VersionCompare} "$R0" "$R1" $R2
    ; $R2="2"   version2 is newer
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${VersionConvert} "0.15c-9m" "" $R0
    ; $R0="0.15.03.9.13"


    ${VersionConvert} "0.15c-1n" "" $R1
    ; $R1="0.15.03.1.14"


    ${VersionCompare} "$R0" "$R1" $R2
    ; $R2="1"   version1 is newer
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${VersionConvert} "0.15c+" "abcdefghijklmnopqrstuvwxyz+" $R0
    ; $R0="0.15.0327"


    ${VersionConvert} "0.15c" "abcdefghijklmnopqrstuvwxyz+" $R1
    ; $R1="0.15.03"


    ${VersionCompare} "$R0" "$R1" $R2
    ; $R2="1"   version1 is newer
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordAdd}

> Add words to string1 from string2 if not exist or delete words if exist.

Add words to string1 from string2 if not exist or delete words if exist.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordAdd} "[string1]" "[delimiter]" "[E][options]" $var


"[string1]"          ;[string1]
                     ;  string for addition or removing
"[delimiter]"        ;[delimiter]
                     ;  one or several symbols
"[E][options]"       ;[options]
                     ;  +string2 : words to add
                     ;  -string2 : words to delete
                     ;
                     ;[E]
                     ;  with errorlevel output
                     ;  IfErrors:
                     ;     $var=1  delimiter is empty
                     ;     $var=3  syntax error (use: +text,-text)
                     ;[]
                     ;  no errorlevel output (default)
                     ;  If some errors found then (result=input string)
                     ;
$var                 ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### add

[Section titled “add”](#add)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\WINDOWS" " " "+C:\WINDOWS C:\config.sys" $R0
    ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
SectionEnd
```

### delete

[Section titled “delete”](#delete)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
    ; $R0="C:\logo.sys"
SectionEnd
```

### add to one

[Section titled “add to one”](#add-to-one)

```plaintext
Section
    ${WordAdd} "C:\io.sys" " " "+C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
    ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
SectionEnd
```

### delete one

[Section titled “delete one”](#delete-one)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS" $R0
    ; $R0="C:\io.sys C:\logo.sys"
SectionEnd
```

### No new words found

[Section titled “No new words found”](#no-new-words-found)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\logo.sys" " " "+C:\logo.sys" $R0
    StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
    MessageBox MB_OK "No new words found to add"
SectionEnd
```

### No words deleted

[Section titled “No words deleted”](#no-words-deleted)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\logo.sys" " " "-C:\config.sys" $R0
    StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
    MessageBox MB_OK "No words found to delete"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordAdd} "C:\io.sys C:\logo.sys" "" "E-C:\logo.sys" $R0
    ; $R0="1" (delimiter is empty "")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordInsert}

> Insert word in string.

Insert word in string.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordInsert} "[string]" "[delimiter]" "[word]" "[E][options]" $var
```

***

```plaintext
"[string]"          ;[string]
                    ;  input string
"[delimiter]"       ;[delimiter]
                    ;  one or several symbols
"[word]"            ;[word]
                    ;  word to insert
"[E][options]"      ;[options]
                    ;  +number  : word number from start
                    ;  -number  : word number from end
                    ;
                    ;[E]
                    ;  with errorlevel output
                    ;  IfErrors:
                    ;     $var=1  delimiter is empty
                    ;     $var=2  wrong word number
                    ;     $var=3  syntax error (Use: +1,-1)
                    ;[]
                    ;  no errorlevel output (default)
                    ;  If some errors found then (result=input string)
                    ;
$var                ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### add

[Section titled “add”](#add)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\WINDOWS" " " "+C:\WINDOWS C:\config.sys" $R0
    ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
SectionEnd
```

### delete

[Section titled “delete”](#delete)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
    ; $R0="C:\logo.sys"
SectionEnd
```

### add to one

[Section titled “add to one”](#add-to-one)

```plaintext
Section
    ${WordAddS} "C:\io.sys" " " "+C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
    ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
SectionEnd
```

### delete one

[Section titled “delete one”](#delete-one)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS" $R0
    ; $R0="C:\io.sys C:\logo.sys"
SectionEnd
```

### No new words found

[Section titled “No new words found”](#no-new-words-found)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\logo.sys" " " "+C:\logo.sys" $R0
    StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
    MessageBox MB_OK "No new words found to add"
SectionEnd
```

### No words deleted

[Section titled “No words deleted”](#no-words-deleted)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\logo.sys" " " "-C:\config.sys" $R0
    StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
    MessageBox MB_OK "No words found to delete"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordAddS} "C:\io.sys C:\logo.sys" "" "E-C:\logo.sys" $R0
    ; $R0="1" (delimiter is empty "")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFind}

> Multi-features string function.

Multi-features string function.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFind} "[string]" "[delimiter]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter]"      ;[delimiter]
                   ;  one or several symbols
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}  : delimiter number from start
                   ;              all space after this
                   ;              delimiter to output
                   ;  +number{  : delimiter number from start
                   ;              all space before this
                   ;              delimiter to output
                   ;  +number}} : word number from start
                   ;              all space after this word
                   ;              to output
                   ;  +number{{ : word number from start
                   ;              all space before this word
                   ;              to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  *         : sum of delimiters to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  delimiter not found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1},#,*,/word,...)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

Notes:

* Accepted numbers 1,01,001,…

## Examples

[Section titled “Examples”](#examples)

### Find word by number

[Section titled “Find word by number”](#find-word-by-number)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\Program Files C:\WINDOWS" " C:\" "-02" $R0
    ; $R0="Program Files"
SectionEnd
```

### Delimiter exclude

[Section titled “Delimiter exclude”](#delimiter-exclude)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "-2}" $R0
    ; $R0=" C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Sum of words

[Section titled “Sum of words”](#sum-of-words)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " C:\" "#" $R0
    ; $R0="3"
SectionEnd
```

### Sum of delimiters

[Section titled “Sum of delimiters”](#sum-of-delimiters)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "*" $R0
    ; $R0="2"
SectionEnd
```

### Find word number

[Section titled “Find word number”](#find-word-number)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\Program Files C:\WINDOWS" " " "/Files" $R0
    ; $R0="3"
SectionEnd
```

### }}

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2}}" $R0
    ; $R0=" C:\WINDOWS"
SectionEnd
```

### {}

[Section titled “{}”](#-1)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2{}" $R0
    ; $R0="C:\io.sys C:\WINDOWS"
SectionEnd
```

### \*}

[Section titled “\*}”](#-2)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2*}" $R0
    ; $R0="C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Get parent directory

[Section titled “Get parent directory”](#get-parent-directory)

```plaintext
Section
    StrCpy $R0 "C:\Program Files\NSIS\NSIS.chm"
;               "C:\Program Files\NSIS\Include\"
;               "C:\\Program Files\\NSIS\\NSIS.chm"


    ${WordFind} "$R0" "\" "-2{*" $R0
    ; $R0="C:\Program Files\NSIS"
    ;     "C:\\Program Files\\NSIS"
SectionEnd
```

### Coordinates

[Section titled “Coordinates”](#coordinates)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" ":\lo" "E+1{" $R0
    ; $R0="C:\io.sys C"
    IfErrors end


    StrLen $0 $R0             ; $0 = Start position of word (11)
    StrLen $1 ':\lo'          ; $1 = Word length (4)
    ; StrCpy $R0 $R1 $1 $0    ; $R0 = :\lo


    end:
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFind} "[string]" "[delimiter]" "E[options]" $R0


    IfErrors 0 end
    StrCmp $R0 1 0 +2       ; errorlevel 1?
    MessageBox MB_OK 'delimiter not found' IDOK end
    StrCmp $R0 2 0 +2       ; errorlevel 2?
    MessageBox MB_OK 'no such word number' IDOK end
    StrCmp $R0 3 0 +2       ; errorlevel 3?
    MessageBox MB_OK 'syntax error'


    end:
SectionEnd
```

### Without errorlevel output

[Section titled “Without errorlevel output”](#without-errorlevel-output)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys" "_" "+1" $R0


    ; $R0="C:\io.sys C:\logo.sys" (error: delimiter "_" not found)
SectionEnd
```

### If found

[Section titled “If found”](#if-found)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys" ":\lo" "E+1{" $R0


    IfErrors notfound found
    found:
    MessageBox MB_OK 'Found' IDOK end
    notfound:
    MessageBox MB_OK 'Not found'


    end:
SectionEnd
```

### If found 2

[Section titled “If found 2”](#if-found-2)

```plaintext
Section
    ${WordFind} "C:\io.sys C:\logo.sys" ":\lo" "+1{" $R0


    StrCmp $R0 "C:\io.sys C:\logo.sys" notfound found        ; error?
    found:
    MessageBox MB_OK 'Found' IDOK end
    notfound:
    MessageBox MB_OK 'Not found'


    end:
SectionEnd
```

### To accept one word in string if delimiter not found

[Section titled “To accept one word in string if delimiter not found”](#to-accept-one-word-in-string-if-delimiter-not-found)

```plaintext
Section
    StrCpy $0 'OneWord'
    StrCpy $1 1


    loop:
    ${WordFind} "$0" " " "E+$1" $R0
    IfErrors 0 code
    StrCmp $1$R0 11 0 error
    StrCpy $R0 $0
    goto end


    code:
    ; ...
    IntOp $1 $1 + 1
    goto loop


    error:
    StrCpy $1 ''
    StrCpy $R0 ''


    end:
    ; $R0="OneWord"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFind2X}

> Find word between two delimiters.

Find word between two delimiters.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFind2X} "[string]" "[delimiter1]" "[delimiter2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter1]"     ;[delimiter1]
                   ;  first delimiter
"[delimiter2]"     ;[delimiter2]
                   ;  second delimiter
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}} : word number from start all space
                   ;              after this word to output
                   ;  +number{{ : word number from end all space
                   ;              before this word to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  no words found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,#)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordFind2X} "[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]" "[C:\" "];" "+2" $R0
    ; $R0="logo.sys"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1" $R0
    ; $R0="logo"
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{{" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:"
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{}" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:sys"
SectionEnd
```

### Example 5

[Section titled “Example 5”](#example-5)

```plaintext
Section
    ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{*" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:\logo."
SectionEnd
```

### Example 6

[Section titled “Example 6”](#example-6)

```plaintext
Section
    ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "/logo" $R0
    ; $R0="2"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFind2X} "[io.sys];[C:\logo.sys]" "\" "];" "E+1" $R0
    ; $R0="1" ("\...];" not found)


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFind2XS}

> Find word between two delimiters, case sensitive

Find word between two delimiters, case sensitive

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFind2XS} "[string]" "[delimiter1]" "[delimiter2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter1]"     ;[delimiter1]
                   ;  first delimiter
"[delimiter2]"     ;[delimiter2]
                   ;  second delimiter
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}} : word number from start all space
                   ;              after this word to output
                   ;  +number{{ : word number from end all space
                   ;              before this word to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  no words found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,#)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordFind2XS} "[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]" "[C:\" "];" "+2" $R0
    ; $R0="logo.sys"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordFind2XS} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1" $R0
    ; $R0="logo"
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${WordFind2XS} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{{" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:"
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${WordFind2XS} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{}" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:sys"
SectionEnd
```

### Example 5

[Section titled “Example 5”](#example-5)

```plaintext
Section
    ${WordFind2XS} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{*" $R0
    ; $R0="C:\WINDOWS C:\io.sys C:\logo."
SectionEnd
```

### Example 6

[Section titled “Example 6”](#example-6)

```plaintext
Section
    ${WordFind2XS} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "/logo" $R0
    ; $R0="2"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFind2XS} "[io.sys];[C:\logo.sys]" "\" "];" "E+1" $R0
    ; $R0="1" ("\...];" not found)


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFind3X}

> Find a word that contains a string, between two delimiters.

Find a word that contains a string, between two delimiters.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFind3X} "[string]" "[delimiter1]" "[center]" "[delimiter2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter1]"     ;[delimiter1]
                   ;  first delimiter
"[center]"         ;[center]
                   ;  center string
"[delimiter2]"     ;[delimiter2]
                   ;  second delimiter
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}} : word number from start all space
                   ;              after this word to output
                   ;  +number{{ : word number from end all space
                   ;              before this word to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  no words found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,#)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "+1" $R0
    ; $R0="1.AAB"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1" $R0
    ; $R0="2.BAA"
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{{" $R0
    ; $R0="[1.AAB];"
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{}" $R0
    ; $R0="[1.AAB];[3.BBB];"
SectionEnd
```

### Example 5

[Section titled “Example 5”](#example-5)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{*" $R0
    ; $R0="[1.AAB];[2.BAA];"
SectionEnd
```

### Example 6

[Section titled “Example 6”](#example-6)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "/2.BAA" $R0
    ; $R0="2"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "XX" "];" "E+1" $R0
    ; $R0="1" ("[...XX...];" not found)


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFind3XS}

> Find a word that contains a string, between two delimiters, case sensitive.

Find a word that contains a string, between two delimiters, case sensitive.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFind3XS} "[string]" "[delimiter1]" "[center]" "[delimiter2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter1]"     ;[delimiter1]
                   ;  first delimiter
"[center]"         ;[center]
                   ;  center string
"[delimiter2]"     ;[delimiter2]
                   ;  second delimiter
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}} : word number from start all space
                   ;              after this word to output
                   ;  +number{{ : word number from end all space
                   ;              before this word to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  no words found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,#)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "+1" $R0
    ; $R0="1.AAB"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1" $R0
    ; $R0="2.BAA"
SectionEnd
```

### Example 3

[Section titled “Example 3”](#example-3)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{{" $R0
    ; $R0="[1.AAB];"
SectionEnd
```

### Example 4

[Section titled “Example 4”](#example-4)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{}" $R0
    ; $R0="[1.AAB];[3.BBB];"
SectionEnd
```

### Example 5

[Section titled “Example 5”](#example-5)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{*" $R0
    ; $R0="[1.AAB];[2.BAA];"
SectionEnd
```

### Example 6

[Section titled “Example 6”](#example-6)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "/2.BAA" $R0
    ; $R0="2"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFind3XS} "[1.AAB];[2.BAA];[3.BBB];" "[" "XX" "];" "E+1" $R0
    ; $R0="1" ("[...XX...];" not found)


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordFindS}

> Multi-features string function, case sensitive

Multi-features string function, case sensitive

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordFindS} "[string]" "[delimiter]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[delimiter]"      ;[delimiter]
                   ;  one or several symbols
"[E][options]"     ;[options]
                   ;  +number   : word number from start
                   ;  -number   : word number from end
                   ;  +number}  : delimiter number from start
                   ;              all space after this
                   ;              delimiter to output
                   ;  +number{  : delimiter number from start
                   ;              all space before this
                   ;              delimiter to output
                   ;  +number}} : word number from start
                   ;              all space after this word
                   ;              to output
                   ;  +number{{ : word number from start
                   ;              all space before this word
                   ;              to output
                   ;  +number{} : word number from start
                   ;              all space before and after
                   ;              this word (word exclude)
                   ;  +number*} : word number from start
                   ;              all space after this
                   ;              word to output with word
                   ;  +number{* : word number from start
                   ;              all space before this
                   ;              word to output with word
                   ;  #         : sum of words to output
                   ;  *         : sum of delimiters to output
                   ;  /word     : number of word to output
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  delimiter not found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1},#,*,/word,...)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

Notes:

* Accepted numbers 1,01,001,…

## Examples

[Section titled “Examples”](#examples)

### Find word by number

[Section titled “Find word by number”](#find-word-by-number)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\Program Files C:\WINDOWS" " C:\" "-02" $R0
    ; $R0="Program Files"
SectionEnd
```

### Delimiter exclude

[Section titled “Delimiter exclude”](#delimiter-exclude)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "-2}" $R0
    ; $R0=" C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Sum of words

[Section titled “Sum of words”](#sum-of-words)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" " C:\" "#" $R0
    ; $R0="3"
SectionEnd
```

### Sum of delimiters

[Section titled “Sum of delimiters”](#sum-of-delimiters)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "*" $R0
    ; $R0="2"
SectionEnd
```

### Find word number

[Section titled “Find word number”](#find-word-number)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\Program Files C:\WINDOWS" " " "/Files" $R0
    ; $R0="3"
SectionEnd
```

### }}

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2}}" $R0
    ; $R0=" C:\WINDOWS"
SectionEnd
```

### {}

[Section titled “{}”](#-1)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2{}" $R0
    ; $R0="C:\io.sys C:\WINDOWS"
SectionEnd
```

### \*}

[Section titled “\*}”](#-2)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2*}" $R0
    ; $R0="C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Get parent directory

[Section titled “Get parent directory”](#get-parent-directory)

```plaintext
Section
    StrCpy $R0 "C:\Program Files\NSIS\NSIS.chm"
;               "C:\Program Files\NSIS\Include\"
;               "C:\\Program Files\\NSIS\\NSIS.chm"


    ${WordFindS} "$R0" "\" "-2{*" $R0
    ; $R0="C:\Program Files\NSIS"
    ;     "C:\\Program Files\\NSIS"
SectionEnd
```

### Coordinates

[Section titled “Coordinates”](#coordinates)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys C:\WINDOWS" ":\lo" "E+1{" $R0
    ; $R0="C:\io.sys C"
    IfErrors end


    StrLen $0 $R0             ; $0 = Start position of word (11)
    StrLen $1 ':\lo'          ; $1 = Word length (4)
    ; StrCpy $R0 $R1 $1 $0    ; $R0 = :\lo


    end:
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordFindS} "[string]" "[delimiter]" "E[options]" $R0


    IfErrors 0 end
    StrCmp $R0 1 0 +2       ; errorlevel 1?
    MessageBox MB_OK 'delimiter not found' IDOK end
    StrCmp $R0 2 0 +2       ; errorlevel 2?
    MessageBox MB_OK 'no such word number' IDOK end
    StrCmp $R0 3 0 +2       ; errorlevel 3?
    MessageBox MB_OK 'syntax error'


    end:
SectionEnd
```

### Without errorlevel output

[Section titled “Without errorlevel output”](#without-errorlevel-output)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys" "_" "+1" $R0


    ; $R0="C:\io.sys C:\logo.sys" (error: delimiter "_" not found)
SectionEnd
```

### If found

[Section titled “If found”](#if-found)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys" ":\lo" "E+1{" $R0


    IfErrors notfound found
    found:
    MessageBox MB_OK 'Found' IDOK end
    notfound:
    MessageBox MB_OK 'Not found'


    end:
SectionEnd
```

### If found 2

[Section titled “If found 2”](#if-found-2)

```plaintext
Section
    ${WordFindS} "C:\io.sys C:\logo.sys" ":\lo" "+1{" $R0


    StrCmp $R0 "C:\io.sys C:\logo.sys" notfound found        ; error?
    found:
    MessageBox MB_OK 'Found' IDOK end
    notfound:
    MessageBox MB_OK 'Not found'


    end:
SectionEnd
```

### To accept one word in string if delimiter not found

[Section titled “To accept one word in string if delimiter not found”](#to-accept-one-word-in-string-if-delimiter-not-found)

```plaintext
Section
    StrCpy $0 'OneWord'
    StrCpy $1 1


    loop:
    ${WordFindS} "$0" " " "E+$1" $R0
    IfErrors 0 code
    StrCmp $1$R0 11 0 error
    StrCpy $R0 $0
    goto end


    code:
    ; ...
    IntOp $1 $1 + 1
    goto loop


    error:
    StrCpy $1 ''
    StrCpy $R0 ''


    end:
    ; $R0="OneWord"
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordInsert}

> Insert word in string.

Insert word in string.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordInsert} "[string]" "[delimiter]" "[word]" "[E][options]" $var


"[string]"          ;[string]
                    ;  input string
"[delimiter]"       ;[delimiter]
                    ;  one or several symbols
"[word]"            ;[word]
                    ;  word to insert
"[E][options]"      ;[options]
                    ;  +number  : word number from start
                    ;  -number  : word number from end
                    ;
                    ;[E]
                    ;  with errorlevel output
                    ;  IfErrors:
                    ;     $var=1  delimiter is empty
                    ;     $var=2  wrong word number
                    ;     $var=3  syntax error (Use: +1,-1)
                    ;[]
                    ;  no errorlevel output (default)
                    ;  If some errors found then (result=input string)
                    ;
$var                ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordInsert} "C:\io.sys C:\WINDOWS" " " "C:\logo.sys" "-2" $R0
    ; $R0="C:\io.sys C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordInsert} "C:\io.sys" " " "C:\WINDOWS" "+2" $R0
    ; $R0="C:\io.sys C:\WINDOWS"
SectionEnd
```

### Example (3)

[Section titled “Example (3)”](#example-3)

```plaintext
Section
    ${WordInsert} "" " " "C:\WINDOWS" "+1" $R0
    ; $R0="C:\WINDOWS "
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordInsert} "C:\io.sys C:\logo.sys" " " "C:\logo.sys" "E+4" $R0
    ; $R0="2" (wrong word number "+4")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordInsertS}

> Insert word in string.

Insert word in string.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordInsertS} "[string]" "[delimiter]" "[word]" "[E][options]" $var


"[string]"          ;[string]
                    ;  input string
"[delimiter]"       ;[delimiter]
                    ;  one or several symbols
"[word]"            ;[word]
                    ;  word to insert
"[E][options]"      ;[options]
                    ;  +number  : word number from start
                    ;  -number  : word number from end
                    ;
                    ;[E]
                    ;  with errorlevel output
                    ;  IfErrors:
                    ;     $var=1  delimiter is empty
                    ;     $var=2  wrong word number
                    ;     $var=3  syntax error (Use: +1,-1)
                    ;[]
                    ;  no errorlevel output (default)
                    ;  If some errors found then (result=input string)
                    ;
$var                ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### Example 1

[Section titled “Example 1”](#example-1)

```plaintext
Section
    ${WordInsertS} "C:\io.sys C:\WINDOWS" " " "C:\logo.sys" "-2" $R0
    ; $R0="C:\io.sys C:\logo.sys C:\WINDOWS"
SectionEnd
```

### Example 2

[Section titled “Example 2”](#example-2)

```plaintext
Section
    ${WordInsertS} "C:\io.sys" " " "C:\WINDOWS" "+2" $R0
    ; $R0="C:\io.sys C:\WINDOWS"
SectionEnd
```

### Example (3)

[Section titled “Example (3)”](#example-3)

```plaintext
Section
    ${WordInsertS} "" " " "C:\WINDOWS" "+1" $R0
    ; $R0="C:\WINDOWS "
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordInsertS} "C:\io.sys C:\logo.sys" " " "C:\logo.sys" "E+4" $R0
    ; $R0="2" (wrong word number "+4")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordReplace}

> Replace or delete word from string.

Replace or delete word from string.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordReplace} "[string]" "[word1]" "[word2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[word1]"          ;[word1]
                   ;  word to replace or delete
"[word2]"          ;[word2]
                   ;  replace with (if empty delete)
"[E][options]"     ;[options]
                   ;  +number  : word number from start
                   ;  -number  : word number from end
                   ;  +number* : word number from start multiple-replace
                   ;  -number* : word number from end multiple-replace
                   ;  +        : replace all results
                   ;  +*       : multiple-replace all results
                   ;  {        : if exists replace all delimiters
                   ;               from left edge
                   ;  }        : if exists replace all delimiters
                   ;               from right edge
                   ;  {}       : if exists replace all delimiters
                   ;               from edges
                   ;  {*       : if exists multiple-replace all
                   ;               delimiters from left edge
                   ;  }*       : if exists multiple-replace all
                   ;               delimiters from right edge
                   ;  {}*      : if exists multiple-replace all
                   ;               delimiters from edges
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  word to replace not found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,+1*,-1*,+,+*,{},{}*)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### replace

[Section titled “replace”](#replace)

```plaintext
Section
    ${WordReplace} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "bmp" "+2" $R0
    ; $R0="C:\io.sys C:\logo.bmp C:\WINDOWS"
SectionEnd
```

### delete

[Section titled “delete”](#delete)

```plaintext
Section
    ${WordReplace} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "" "+" $R0
    ; $R0="C:\io. C:\logo. C:\WINDOWS"
SectionEnd
```

### multiple-replace 1

[Section titled “multiple-replace 1”](#multiple-replace-1)

```plaintext
Section
    ${WordReplace} "C:\io.sys      C:\logo.sys   C:\WINDOWS" " " " " "+1*" $R0
    ; +1* or +2* or +3* or +4* or +5* or +6*
    ; $R0="C:\io.sys C:\logo.sys   C:\WINDOWS"
SectionEnd
```

### multiple-replace 2

[Section titled “multiple-replace 2”](#multiple-replace-2)

```plaintext
Section
    ${WordReplace} "C:\io.sys C:\logo.sysSYSsys C:\WINDOWS" "sys" "bmp" "+*" $R0
    ; $R0="C:\io.bmp C:\logo.bmp C:\WINDOWS"
SectionEnd
```

### multiple-replace 3

[Section titled “multiple-replace 3”](#multiple-replace-3)

```plaintext
Section
    ${WordReplace} "sysSYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys" "sys" "|" "{}*" $R0
    ; $R0="|C:\io.sys C:\logo.sys C:\WINDOWS|"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordReplace} "C:\io.sys C:\logo.sys" "sys" "bmp" "E+3" $R0
    ; $R0="2" (no such word number "+3")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${WordReplaceS}

> Replace or delete word from string, case sensitive.

Replace or delete word from string, case sensitive.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${WordReplaceS} "[string]" "[word1]" "[word2]" "[E][options]" $var


"[string]"         ;[string]
                   ;  input string
"[word1]"          ;[word1]
                   ;  word to replace or delete
"[word2]"          ;[word2]
                   ;  replace with (if empty delete)
"[E][options]"     ;[options]
                   ;  +number  : word number from start
                   ;  -number  : word number from end
                   ;  +number* : word number from start multiple-replace
                   ;  -number* : word number from end multiple-replace
                   ;  +        : replace all results
                   ;  +*       : multiple-replace all results
                   ;  {        : if exists replace all delimiters
                   ;               from left edge
                   ;  }        : if exists replace all delimiters
                   ;               from right edge
                   ;  {}       : if exists replace all delimiters
                   ;               from edges
                   ;  {*       : if exists multiple-replace all
                   ;               delimiters from left edge
                   ;  }*       : if exists multiple-replace all
                   ;               delimiters from right edge
                   ;  {}*      : if exists multiple-replace all
                   ;               delimiters from edges
                   ;
                   ;[E]
                   ;  with errorlevel output
                   ;  IfErrors:
                   ;     $var=1  word to replace not found
                   ;     $var=2  no such word number
                   ;     $var=3  syntax error (Use: +1,-1,+1*,-1*,+,+*,{},{}*)
                   ;[]
                   ;  no errorlevel output (default)
                   ;  If some errors found then (result=input string)
                   ;
$var               ;output (result)
```

## Examples

[Section titled “Examples”](#examples)

### replace

[Section titled “replace”](#replace)

```plaintext
Section
    ${WordReplaceS} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "bmp" "+2" $R0
    ; $R0="C:\io.sys C:\logo.bmp C:\WINDOWS"
SectionEnd
```

### delete

[Section titled “delete”](#delete)

```plaintext
Section
    ${WordReplaceS} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "" "+" $R0
    ; $R0="C:\io. C:\logo. C:\WINDOWS"
SectionEnd
```

### multiple-replace 1

[Section titled “multiple-replace 1”](#multiple-replace-1)

```plaintext
Section
    ${WordReplaceS} "C:\io.sys      C:\logo.sys   C:\WINDOWS" " " " " "+1*" $R0
    ; +1* or +2* or +3* or +4* or +5* or +6*
    ; $R0="C:\io.sys C:\logo.sys   C:\WINDOWS"
SectionEnd
```

### multiple-replace 2

[Section titled “multiple-replace 2”](#multiple-replace-2)

```plaintext
Section
    ${WordReplaceS} "C:\io.sys C:\logo.sysSYSsys C:\WINDOWS" "sys" "bmp" "+*" $R0
    ; $R0="C:\io.bmp C:\logo.bmp C:\WINDOWS"
SectionEnd
```

### multiple-replace 3

[Section titled “multiple-replace 3”](#multiple-replace-3)

```plaintext
Section
    ${WordReplaceS} "sysSYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys" "sys" "|" "{}*" $R0
    ; $R0="|C:\io.sys C:\logo.sys C:\WINDOWS|"
SectionEnd
```

### With errorlevel output

[Section titled “With errorlevel output”](#with-errorlevel-output)

```plaintext
Section
    ${WordReplaceS} "C:\io.sys C:\logo.sys" "sys" "bmp" "E+3" $R0
    ; $R0="2" (no such word number "+3")


    IfErrors 0 noerrors
    MessageBox MB_OK 'Errorlevel=$R0' IDOK end


    noerrors:
    MessageBox MB_OK 'No errors'


    end:
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Instructor](http://nsis.sourceforge.net/User:Instructor)

# ${DisableX64FSRedirection}

> Disables file system redirection.

Disables file system redirection.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${DisableX64FSRedirection}
```

## Example

[Section titled “Example”](#example)

```plaintext
SetOutPath $SYSDIR
${DisableX64FSRedirection}
File some.dll # extracts to C:\Windows\System32
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${EnableX64FSRedirection}

> Enables file system redirection.

Enables file system redirection.

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
${EnableX64FSRedirection}
```

## Example

[Section titled “Example”](#example)

```plaintext
SetOutPath $SYSDIR
${EnableX64FSRedirection}
File some.dll # extracts to C:\Windows\SysWOW64
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${IsWow64}

> Checks if the installer is a 32-bit application running on a 64-bit OS. Requires LogicLib.

Checks if the installer is a 32-bit application running on a 64-bit OS. Requires [LogicLib](https://github.com/NSIS-Handbook/Documentation/tree/master/Includes/LogicLib).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${IsWow64}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${IsWow64}
    MessageBox MB_OK "running on x64"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# ${RunningX64}

> Checks if the installer is running on x64. Requires LogicLib.

Checks if the installer is running on x64. Requires [LogicLib](https://github.com/NSIS-Handbook/Documentation/tree/master/Includes/LogicLib).

## Syntax

[Section titled “Syntax”](#syntax)

```plaintext
logic_lib_statement ${RunningX64}
```

## Example

[Section titled “Example”](#example)

```plaintext
${If} ${RunningX64}
    MessageBox MB_OK "running on x64"
${EndIf}
```

## Credits

[Section titled “Credits”](#credits)

*unknown*

# NSIS Documentation

> Comprehensive reference for the Nullsoft Scriptable Install System

NSIS (Nullsoft Scriptable Install System) is a professional open-source tool for creating Windows installers. It uses a scripting language to define installer behavior, supporting features like file extraction, registry manipulation, environment variables, user interface customization, and plugin extensibility.

## Key Concepts

[Section titled “Key Concepts”](#key-concepts)

* **Stack-based language**: Many commands push/pop values on a shared stack
* **Compile-time vs. runtime**: Commands prefixed with `!` (e.g., `!include`, `!define`) execute at compile time; unprefixed commands execute at install time
* **Variables**: Built-in variables use a `$` prefix (e.g., `$INSTDIR`, `$TEMP`, `$PROGRAMFILES`)
* **Sections**: Define installer components that the user can select
* **Functions**: Reusable code blocks, including callback functions (e.g., `.onInit`)
* **LogicLib**: Header library providing familiar flow control (`${If}`, `${For}`, `${Switch}`)
* **Plugins**: Extend functionality via DLLs (e.g., `nsExec`, `NSISdl`, `Banner`)

## Documentation Sections

[Section titled “Documentation Sections”](#documentation-sections)

* **[Commands](/llm.txt/commands/)** — All NSIS runtime and compile-time instructions
* **[Variables](/llm.txt/variables/)** — Built-in variables and constants
* **[Callbacks](/llm.txt/callbacks/)** — Installer and uninstaller callback functions
* **[Includes](/llm.txt/includes/)** — Header libraries (LogicLib, FileFunc, StrFunc, etc.)
* **[Plugins](/llm.txt/plugins/)** — Built-in plugin documentation

# AdvSplash.dll

> A small (5.5k), simple plug-in that lets you throw up a splash-screen in NSIS installers with cool fading effects (Windows 2000 or later) and transparency.

A small (5.5k), simple plug-in that lets you throw up a splash-screen in NSIS installers with cool fading effects (Windows 2000 or later) and transparency.

Create a Windows Bitmap (`.bmp`) image to be used as your splash screen. Optionally, you can also create a Wave (`.wav`) audio file to play while the image is being displayed.

By calling the plug-in in [`.onInit`](../Callbacks/onInit.md), your splash-screen will be displayed before the setup interface shows up.

## Parameters

[Section titled “Parameters”](#parameters)

```plaintext
delay fadeIn fadeOut keyColor fileName
```

| Parameter  | Description                                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `delay`    | length to show the screen for (in milliseconds)                                                                                      |
| `fadeIn`   | length to show the fadein scene (in milliseconds) (not included in `delay`, Windows 2000 or later)                                   |
| `fadeOut`  | length to show the fadeout scene (in milliseconds) (not included in `delay`, Windows 2000 or later)                                  |
| `keyColor` | alpha key RGB values (e.g. `0xffff00` for yellow), use -1 when no transparency is used                                               |
| `fileName` | Bitmap file-name (without `.bmp` extension). The file name of the optional audio must match (e.g. `mySplash.bmp` and `mySplash.wav`) |

## Example

[Section titled “Example”](#example)

Simple splash:

```plaintext
Function .onInit
  SetOutPath $PLUGINSDIR


  File /oname=spltmp.bmp "my_splash.bmp"


  AdvSplash::show 1000 600 400 -1 "$TEMP\spltmp"


# $0 has '1' if the user closed the splash screen early,
# '0' if everything closed normally, and '-1' if some error occurred.
  Pop $0


  Delete "$TEMP\spltmp.bmp"
FunctionEnd
```

Transparent with sound:

```plaintext
Function .onInit
  SetOutPath $PLUGINSDIR


  File /oname=spltmp.bmp "my_splash.bmp"
  File /oname=spltmp.wav "my_splashshit.wav"


  AdvSplash::show 1000 600 400 0xf00fee "$TEMP\spltmp"


# $0 has '1' if the user closed the splash screen early,
# '0' if everything closed normally, and '-1' if some error occurred.
  Pop $0


  Delete "$TEMP\spltmp.bmp"
  Delete "$TEMP\spltmp.wav"
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Justin Frankel](https://en.wikipedia.org/wiki/Justin_Frankel) and [Amir Szekely](http://nsis.sourceforge.net/User:Kichik). Fading and transparency by [Nik Medved](http://nsis.sourceforge.net/User:Brainsucker).

## License

[Section titled “License”](#license)

As part of the NSIS distribution, this plug-in is licensed under [zlib/libpng](http://opensource.org/licenses/Zlib)

# Banner.dll

> The Banner plug-in shows a banner with customizable text. It uses the IDD_VERIFY dialog of the UI.

The Banner plug-in shows a banner with customizable text. It uses the `IDD_VERIFY` dialog of the UI.

There are three functions – `show`, `getWindow` and `destroy`.

## Usage

[Section titled “Usage”](#usage)

```plaintext
Banner::show "Text to show"
Banner::getWindow
Banner::destroy
```

### Modern UI

[Section titled “Modern UI”](#modern-ui)

The Modern UI has two labels on the `IDD_VERIFY` dialog. To change all the texts, use:

```plaintext
Banner::show /set 76 "Text 1 (replaces Please wait while Setup is loading...)" "Normal text"
```

### Custom UI

[Section titled “Custom UI”](#custom-ui)

If you have more labels on your `IDD_VERIFY` dialog, you can use multiple `/set` parameters to change the texts.

Example:

```plaintext
Banner::show /set 76 "bah #1" /set 54 "bah #2" "Normal text"
```

The second parameter for \`/set is the ID of the control.

## Example

[Section titled “Example”](#example)

```plaintext
Name "Banner.dll test"
OutFile "Banner Test.exe"
ShowInstDetails show


Function .onInit
    Banner::show "Calculating important stuff..."


    Banner::getWindow
    Pop $1


    again:
    IntOp $0 $0 + 1
    Sleep 1
    StrCmp $0 100 0 again


    GetDlgItem $2 $1 1030
    SendMessage $2 ${WM_SETTEXT} 0 "STR:Calculating more important  stuff..."


    again2:
    IntOp $0 $0 + 1
    Sleep 1
    StrCmp $0 200 0 again2


    Banner::destroy
FunctionEnd


Section
    DetailPrint "Using previous calculations to quickly calculate 1*2000..."
    Sleep 1000
    DetailPrint "Eureka! It's $0!!!"
    DetailPrint ""
SectionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Nik Medved](http://nsis.sourceforge.net/User:Brainsucker) and [Amir Szekely](http://nsis.sourceforge.net/User:Kichik) in honor of the messages dropped during the battle

## License

[Section titled “License”](#license)

As part of the NSIS distribution, this plug-in is licensed under [zlib/libpng](http://opensource.org/licenses/Zlib)

# BgImage.dll

> Displays an image or a gradient with user defined texts and/or images behind the NSIS window. Can also play Wave files.

Displays an image or a gradient with user defined texts and/or images behind the NSIS window. Can also play Wave files.

## Usage

[Section titled “Usage”](#usage)

```plaintext
BgImage::SetBg /GRADIENT 0 0x80 0 0x80 0 0
BgImage::AddImage background.bmp 150 0
BgImage::Redraw
BgImage::Clear
BgImage::Destroy
```

Do not call `SetBg (which creates the window) from a section or a function called by a section.`BgImage\` must be run from the GUI thread as the installation thread is not built to handle GUI.

### Available Functions

[Section titled “Available Functions”](#available-functions)

`SetBg [/FILLSCREEN|/TILED] path_to_bitmap` `SetBg /GRADIENT R G B R G B`

Sets the background and creates the window if necessary

* Use `/FILLSCREEN` to make the image fill the screen
* Use `/TILED` to set a tiled background
* Use `/GRADIENT` to set a gradient background

If `SetReturn on` was called returns “success” on the stack or an error string if there was an error

Do not use in [`.onInit`](../Callbacks/onInit.md)!

`AddImage [/TRANSPARENT R G B] path_to_bitmap X Y`

Adds an image to the background window at (X,Y)

* X and Y can be negative to specify distance from right/bottom
* Use `/TRANSPARENT` to make BgImage draw the image transparently. Define the transparent color using R G B

If `SetReturn on` was called returns “success” on the stack or an error string if there was an error

`AddText text font_handle R G B X Y X Y`

Adds text to the background window

* Use NSIS’s [`CreateFont`](../Commands/CreateFont.md) to create a font and pass it as `font_handle`
* Use R G B to set the text color
* The first X Y is for the top left corner of the text box
* The second X Y is for the bottom right corner of the text box
* X and Y can be negative to specify distance from right/bottoms

If `SetReturn on` was called returns “success” on the stack or an error string if there was an error

`Clear`

Clears all of the current background, images and texts

`Destroy`

Destroys the current background window. Calls `Clear` automatically.

`Sound [/WAIT|/LOOP] path_to_wav` `Sound /STOP`

Plays a wave file

* Use `/WAIT` to wait for the sound to finish playing
* Use `/LOOP` to loop the sound
* Use Sound `/STOP` to stop the loop

`SetReturn on|off`

Enable return values from `SetBg`, `AddImage` and `AddText`

Default value is off because all of the possible errors are either things you should handle when debugging your script such as “can’t load bitmap” or errors you can do nothing about such as “memory allocation error”

## Example

[Section titled “Example”](#example)

```plaintext
Name "BgImage.dll test"
OutFile "BgImage Test.exe"
XPStyle on


!define DEBUG
!macro GetReturnValue
    !ifdef DEBUG
        Pop $R9
        StrCmp $R9 success +2
            DetailPrint "Error: $R9"
    !endif
!macroend


Function .onGUIInit
    # the plugins dir is automatically deleted when the installer exits
    InitPluginsDir


    # lets extract some bitmaps...
    File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
    File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"


    !ifdef DEBUG
        # turn return values on if in debug mode
        BgImage::SetReturn on
    !endif


    # set the initial background for images to be drawn on
    # we will use a gradient from drak green to dark red
    BgImage::SetBg /GRADIENT 0 0x80 0 0x80 0 0
    !insertmacro GetReturnValue


    # add an image @ (150,0)
    BgImage::AddImage $PLUGINSDIR\2.bmp 150 0
    !insertmacro GetReturnValue


    # add the same image only transparent (magenta wiped) @ (150,16)
    BgImage::AddImage /TRANSPARENT 255 0 255 $PLUGINSDIR\2.bmp 150 16
    !insertmacro GetReturnValue


    # create the font for the following text
    CreateFont $R0 "Comic Sans MS" 50 700


    # add a blue shadow for the text
    BgImage::AddText "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
    !insertmacro GetReturnValue


    # add a green shadow for the text
    BgImage::AddText "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
    !insertmacro GetReturnValue


    # add the text
    BgImage::AddText "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
    !insertmacro GetReturnValue


    # show our creation to the world!
    BgImage::Redraw


    # Refresh doesn't return any value
FunctionEnd


Section
    # play some sounds
    FindFirst $0 $1 $WINDIR\Media\*.wav
    StrCmp $0 "" skipSound


    moreSounds:
        StrCmp $1 "" noMoreSounds
        BgImage::Sound /WAIT $WINDIR\Media\$1


        # Sound doesn't return any value either
        MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds
        FindNext $0 $1
        Goto moreSounds


    noMoreSounds:
        FindClose $0


    skipSound:
        # change the background image to Mike, tiled
        BgImage::SetBg /TILED $PLUGINSDIR\1.bmp
        !insertmacro GetReturnValue


    # we have to redraw to reflect the changes
    BgImage::Redraw
    MessageBox MB_OK "Mike the llama"


    # clear everything
    BgImage::Clear


    # Clear doesn't return any value
    # set another gradient
    BgImage::SetBg /GRADIENT 0xFF 0xFA 0xBA 0xAA 0xA5 0x65
    !insertmacro GetReturnValue


    # add some text
    BgImage::AddText "A Desert for Mike" $R0 0 0 0 50 50 800 150
    !insertmacro GetReturnValue


    # add mike as an image
    BgImage::AddImage $PLUGINSDIR\1.bmp 50 150
    !insertmacro GetReturnValue


    # again, we have to call redraw to reflect changes
    BgImage::Redraw
SectionEnd


Function .onGUIEnd
    BgImage::Destroy
    # Destroy doesn't return any value
FunctionEnd
```

## Credits

[Section titled “Credits”](#credits)

Written by [Amir Szekely](http://nsis.sourceforge.net/User:Kichik) with contributions by [Ximon Eighteen](http://nsis.sourceforge.net/User:Sunjammer), [iceman\_k](http://nsis.sourceforge.net/User:Iceman_K), Lajos Molnar and Jason Reis

## License

[Section titled “License”](#license)

As part of the NSIS distribution, this plug-in is licensed under [zlib/libpng](http://opensource.org/licenses/Zlib)

# Dialer

> The Dialer plugin for NSIS provides five functions related to internet connections.

The Dialer plugin for NSIS provides five functions related to internet connections.

To download files from the internet, use the NSISdl plugin.

## Usage

[Section titled “Usage”](#usage)

Simple example:

```plaintext
ClearErrors           ;Clear the error flag
Dialer::FunctionName  ;Call Dialer function
IfErrors "" +3        ;Check for errors
  MessageBox MB_OK "Function not available"
  Quit
Pop $R0               ;Get the return value from the stack
MessageBox MB_OK $R0  ;Display the return value
```

Example function:

```plaintext
; ConnectInternet (uses Dialer plugin)
; Written by Joost Verburg
;
; This function attempts to make a connection to the internet if there is no
; connection available. If you are not sure that a system using the installer
; has an active internet connection, call this function before downloading
; files with NSISdl.
;
; The function requires Internet Explorer 3, but asks to connect manually if
; IE3 is not installed.


Function ConnectInternet


  Push $R0


    ClearErrors
    Dialer::AttemptConnect
    IfErrors noie3


    Pop $R0
    StrCmp $R0 "online" connected
      MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet."
      Quit ;Remove to make error not fatal


    noie3:


    ; IE3 not installed
    MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now."


    connected:


  Pop $R0


FunctionEnd
```

### Functions

[Section titled “Functions”](#functions)

If a function is not available on the system, the error flag will be set.

#### AttemptConnect

[Section titled “AttemptConnect”](#attemptconnect)

Attempts to make a connection to the Internet if the system is not connected.

`online` - already connected / connection successful\
`offline` - connection failed

Requires Internet Explorer 3 or later

#### AutodialOnline

[Section titled “AutodialOnline”](#autodialonline)

Causes the modem to automatically dial the default Internet connection if the system is not connected to the internet. If the system is not set up to automatically connect, it will prompt the user.

Return values:

`online` - already connected / connection successful\
`offline` - connection failed

Requires Internet Explorer 4 or later

#### AutodialUnattended

[Section titled “AutodialUnattended”](#autodialunattended)

Causes the modem to automatically dial the default Internet connection if the system is not connected to the internet. The user will not be prompted.

Return values:

`online` - already connected / connection successful\
`offline` - connection failed

Requires Internet Explorer 4 or later

#### AutodialHangup

[Section titled “AutodialHangup”](#autodialhangup)

Disconnects an automatic dial-up connection.

Return values:

`success` - disconnection successful\
`failure` - disconnection failed

Requires Internet Explorer 4 or later

#### GetConnectedState

[Section titled “GetConnectedState”](#getconnectedstate)

Checks whether the system is connected to the internet.

Return values:

`online` - system is online\
`offline` - system is offline

Requires Internet Explorer 4 or later

## Credits

[Section titled “Credits”](#credits)

Written by [Amir Szekely](http://nsis.sourceforge.net/User:Joost). Readme by [Joost Verburg](http://nsis.sourceforge.net/User:Joost)

# nsExec

> nsExec will execute command-line based programs and capture the output without opening a DOS box.

nsExec will execute command-line based programs and capture the output without opening a DOS box.

## Usage

[Section titled “Usage”](#usage)

```plaintext
nsExec::Exec [/OEM] [/TIMEOUT=x] path
Pop $0


nsExec::ExecToLog [/OEM] [/TIMEOUT=x] path
Pop $0


nsExec::ExecToStack [/OEM] [/TIMEOUT=x] path
Pop $0 ; Return
Pop $1 ; Output
```

All functions are the same except `ExecToLog` will print the output to the log window and `ExecToStack` will push up to `${NSIS_MAX_STRLEN}` characters of output onto the stack after the return value.

Use the /OEM switch to convert the output text from OEM to ANSI.

The timeout value is optional. The timeout is the time in milliseconds `nsExec` will wait for output. If output from the process is received, the timeout value is reset and it will again wait for more output using the timeout value. See Return Value for how to check if there was a timeout.

To ensure that command are executed without problems on all windows versions, is recommended to use the following syntax:

```plaintext
nsExec::ExecToStack [OPTIONS] '"PATH" param1 param2 paramN'
```

This way the application path may contain non 8.3 paths (with spaces)

### Return Value

[Section titled “Return Value”](#return-value)

If `nsExec` is unable to execute the process, it will return “error”on the top of the stack, if the process timed out it will return “timeout”, else it will return the return code from the executed process.

## Credits

[Section titled “Credits”](#credits)

Written by [Robert Rainwater](http://nsis.sourceforge.net/User:Kichik). Thanks to Justin Frankel and \[Amir Szekely]\[3].

# NSISdl

> This plugin can be used from NSIS to download files via HTTP. Note: HTTPS is not supported, only plain HTTP!

This plugin can be used from NSIS to download files via HTTP. Note: HTTPS is not supported, only plain HTTP!

To connect to the internet, use the Dialer plugin.

## Usage

[Section titled “Usage”](#usage)

```plaintext
NSISdl::download http://www.domain.com/file localfile.exe
```

You can also pass /TIMEOUT to set the timeout in milliseconds:

```plaintext
NSISdl::download /TIMEOUT=30000 http://www.domain.com/file localfile.exe
```

The return value is pushed to the stack:

* `cancel` if cancelled
* `success` if success
* otherwise, an error string describing the error

If you don’t want the progress window to appear, use NSISdl::download\_quiet.

Example of usage:

```plaintext
NSISdl::download http://www.domain.com/file localfile.exe
Pop $R0 ;Get the return value
  StrCmp $R0 "success" +3
    MessageBox MB_OK "Download failed: $R0"
    Quit
```

For another example, see waplugin.nsi in the examples directory.

### Proxies

[Section titled “Proxies”](#proxies)

`NSISdl` supports only basic configurations of proxies. It doesn’t support proxies which require authentication, automatic configuration script, etc. `NSISdl` reads the proxy configuration from Internet Explorer’s registry key under `HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings`. It reads and parses `ProxyEnable` and `ProxyServer`.

If you don’t want `NSISdl` to use Internet Explorer’s settings, use the `/NOIEPROXY` flag. `/NOIEPROXY` should be used after `/TRANSLATE` and `/TIMEOUT`. For example:

If you want to specify a proxy on your own, use the `/PROXY` flag.

```plaintext
NSISdl::download /NOIEPROXY http://www.domain.com/file localfile.exe
NSISdl::download /TIMEOUT=30000 /NOIEPROXY http://www.domain.com/file localfile.exe
NSISdl::download /PROXY proxy.whatever.com http://www.domain.com/file localfile.exe
NSISdl::download /PROXY proxy.whatever.com:8080 http://www.domain.com/file localfile.exe
```

### Translate

[Section titled “Translate”](#translate)

To translate `NSISdl` add the following values to the call line:

`/TRANSLATE2` downloading connecting second minute hour seconds minutes hours progress

Default values are:

* `downloading` - “Downloading %s”
* `connecting` - “Connecting …”
* `second` - ” (1 second remaining)”
* `minute` - ” (1 minute remaining)”
* `hour` - ” (1 hour remaining)”
* `seconds` - ” (%u seconds remaining)”
* `minutes` - ” (%u minutes remaining)”
* `hours` - ” (%u hours remaining)”
* `progress` - “%skB (%d%%) of %skB @ %u.%01ukB/s”

The old `/TRANSLATE` method still works for backward compatibility.

`/TRANSLATE` downloading connecting second minute hour plural progress remianing

Default values are:

* `downloading` - “Downloading %s”
* `connecting` - “Connecting …”
* `second` - “second”
* `minute` - “minute”
* `hour` - “hour”
* `plural` - “s”
* `progress` - “%dkB (%d%%) of %ukB @ %d.%01dkB/s”
* `remaining` - ” (%d %s%s remaining)”

`/TRANSLATE` and `/TRANSLATE2` must come before `/TIMEOUT`.

## Credits

[Section titled “Credits”](#credits)

Written by Yaroslav Faybishenko and Justin Frankel.

# Splash

> Small (4k), simple plugin that lets you throw up a splash screen in NSIS installers.

Small (4k), simple plugin that lets you throw up a splash screen in NSIS installers.

## Usage

[Section titled “Usage”](#usage)

```plaintext
Function .onInit
  SetOutPath $TEMP
  File /oname=spltmp.bmp "my_splash.bmp"


; optional
; File /oname=spltmp.wav "my_splashsound.wav"


  splash::show 1000 $TEMP\spltmp


  Pop $0 ; $0 has '1' if the user closed the splash screen early,
     ; '0' if everything closed normally, and '-1' if some error occurred.


  Delete $TEMP\spltmp.bmp
;  Delete $TEMP\spltmp.wav
FunctionEnd
```

Note that the first parameter to splash.exe is the length to show the screen for (in milliseconds), and the second is the splash bitmap filename (without the .bmp). The BMP file used will be this parameter.bmp, and the wave file used (if present) will be this parameter.wav.

(If you already have an .onInit function, put that in it)

Note: the return value of splash is 1 if the user closed the splash screen early (pop it from the stack)

## Credits

[Section titled “Credits”](#credits)

Written by Justin Frankel and [Amir Szekely](http://nsis.sourceforge.net/User:Kichik).

# VPatch

> VPatch allows to create a patch file to update previous versions of your software. The GenPat utility generates the patch file. The plug-in can use the patch to…

VPatch allows to create a patch file to update previous versions of your software. The GenPat utility generates the patch file. The plug-in can use the patch to update a file. Using a patch, you can reduce the download size of your updates because only the differences between the files are included in the patch file.

## Usage

[Section titled “Usage”](#usage)

### Generate the patch file

[Section titled “Generate the patch file”](#generate-the-patch-file)

Make sure you have the source file (original version) and the target file (version to update to). For example, `DATA.DTA` (currently on user system) and `DATA_20.DTA` (version 2.0 of this data file). Now call the command line tool `GenPat.exe`:

```plaintext
`GENPAT oldfile.txt newfile.txt patch.pat
```

Now, the patch will be generated, this will take some time.

Using the `/B=(BlockSize)` parameter of the GenPat utility (put it after the filenames), you can use a different block size. A smaller block size may result in a smaller patch, but the generation will take more time (the default blocksize is 64).

If you have trouble using this command-line utility, you can download a GUI (graphical user interface) for VPatch from its own [website](http://www.tibed.net/vpatch).

### Update the file during installation

[Section titled “Update the file during installation”](#update-the-file-during-installation)

Use the VPatch plug-in to update a file using a patch file:

`vpatch::vpatchfile "patch.pat" "oldfile.txt" "temporary_newfile.txt"`

The result of the patch operating will be added to the stack and can be one of the following texts:

* OK
* OK, new version already installed
* An error occurred while patching
* Patch data is invalid or corrupt
* No suitable patches were found

Check `example.nsi` for an example. You should check whether the stack string starts with “OK” because then the patch has succeeded and you can rename “temporary\_newfile.txt” to “oldfile.txt” to replace the original, if you want.

### Multiple patches in one file

[Section titled “Multiple patches in one file”](#multiple-patches-in-one-file)

GenPat appends a patch to the file you specified. If there is already a patch for the same original file, with the same CRC/MD5, in the patch file, the patch will be replaced. For example, if you want to be able to upgrade version 1 and 2 to version 3, you can put a 1 > 3 and 2 > 3 patch in one file.

You can also put patches for different files in one patch file, for example, a patch from file A version 1 to file A version 2 and a patch from file B version 1 to file B version 2. Just call the plug-in multiple times with the same patch file. It will automatically select the right patch (based on the file CRC).

### Patch generator (GenPat) exit codes

[Section titled “Patch generator (GenPat) exit codes”](#patch-generator-genpat-exit-codes)

In version 3 the following exit codes (known as error levels in the DOS period) can be returned by GenPat. GenPat will return an exit code based on success of the patch generation. Here is a list of the possible exit codes:

| Exit code | Description                                                                                |
| --------- | ------------------------------------------------------------------------------------------ |
| 0         | Success                                                                                    |
| 1         | Arguments missing                                                                          |
| 2         | Other error                                                                                |
| 3         | Source file already has a patch in specified patch file (ERROR), use /R switch to override |

These exit codes can be useful when you generate patch files through a NSIS script.

## Credits

[Section titled “Credits”](#credits)

Written by Koen van de Sande.

# $ADMINTOOLS

> A directory where administrative tools are kept. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default…

A directory where administrative tools are kept. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is available on Windows 2000, ME and above.

## History

[Section titled “History”](#history)

Not documented

# $APPDATA

> The application data directory. Detection of the current user path requires Internet Explorer 4 and above. Detection of the all users path requires Internet…

The application data directory. Detection of the current user path requires Internet Explorer 4 and above. Detection of the all users path requires Internet Explorer 5 and above. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.

## History

[Section titled “History”](#history)

Not documented

# $CDBURN_AREA

> A directory where files awaiting to be burned to CD are stored.

A directory where files awaiting to be burned to CD are stored.

This constant is available on Windows XP and above.

## History

[Section titled “History”](#history)

Not documented

# $CMDLINE

> The command line of the installer. The format of the command line can be one of the following:

The command line of the installer. The format of the command line can be one of the following:

* “full\path to\installer.exe” PARAMETER PARAMETER PARAMETER
* installer.exe PARAMETER PARAMETER PARAMETER
* For parsing out the PARAMETER portion, see [`GetParameters`](../Includes/FileFunc/GetParameters.md). If `/D=` is specified on the command line (to override the install directory) it won’t show up in `$CMDLINE`.

## History

[Section titled “History”](#history)

Added in NSIS v1.65

# $COMMONFILES

> The common files directory. This is a directory for components that are shared across applications (usually C:\Program Files\Common Files but detected at…

The common files directory. This is a directory for components that are shared across applications (usually `C:\Program Files\Common Files` but detected at runtime). On Windows x64, `$COMMONFILES` and `$COMMONFILES32` point to `C:\Program Files (x86)\Common Files` while `$COMMONFILES64` points to `C:\Program Files\Common Files`. Use `$COMMONFILES64` when installing x64 applications.

## History

[Section titled “History”](#history)

`$COMMONFILES32` and `$COMMONFILES64` added in NSIS 2.26

# $COOKIES

> Internet Explorer's cookies directory.

Internet Explorer’s cookies directory.

This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.

## History

[Section titled “History”](#history)

Not documented

# $DESKTOP

> The Windows desktop directory (usually C:\Windows\Desktop but detected at runtime). The context of this constant (All Users or Current user) depends on the…

The Windows desktop directory (usually `C:\Windows\Desktop` but detected at runtime). The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

## History

[Section titled “History”](#history)

Not documented

# $DOCUMENTS

> The documents directory. A typical path for the current user is C:\Documents and Settings\Foo\My Documents. The context of this constant (All Users or Current…

The documents directory. A typical path for the current user is `C:\Documents and Settings\Foo\My Documents`. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is not available on Windows 95 with Internet Explorer 4 not installed.

## History

[Section titled “History”](#history)

Not documented

# $EXEDIR

> The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea).

The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea).

## History

[Section titled “History”](#history)

Not documented

# $EXEFILE

> The base name of the installer executable.

The base name of the installer executable.

## History

[Section titled “History”](#history)

Added in NSIS v2.26

# $EXEPATH

> The full path of the installer executable.

The full path of the installer executable.

## History

[Section titled “History”](#history)

Added in NSIS v2.26

# $FAVORITES

> The directory that contains shortcuts to the user's favorite websites, documents, etc. The context of this constant (All Users or Current user) depends on the…

The directory that contains shortcuts to the user’s favorite websites, documents, etc. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is not available on Windows 95 with Internet Explorer 4 not installed.

## History

[Section titled “History”](#history)

Not documented

# $FONTS

> The system's fonts directory.

The system’s fonts directory.

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 1

# $HISTORY

> Internet Explorer's history directory.

Internet Explorer’s history directory.

This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.

## History

[Section titled “History”](#history)

Not documented

# $HWNDPARENT

> The decimal HWND of the parent window.

The decimal HWND of the parent window.

## History

[Section titled “History”](#history)

Not documented

# $INSTDIR

> The installation directory ($INSTDIR is modifiable using StrCpy, ReadRegStr, ReadINIStr, etc. - This could be used, for example, in the .onInit function to do a…

The installation directory (`$INSTDIR` is modifiable using [`StrCpy`](../Commands/StrCpy.md), [`ReadRegStr`](../Commands/ReadRegStr.md), [`ReadINIStr`](../Commands/ReadINIStr.md), etc. - This could be used, for example, in the [`.onInit`](../Callbacks/onInit.md) function to do a more advanced detection of install location).

Note that in uninstaller code, `$INSTDIR` contains the directory where the uninstaller lies. It does not necessarily contain the same value it contained in the installer. For example, if you write the uninstaller to [`$WINDIR`](WINDIR.md) and the user doesn’t move it, `$INSTDIR` will be [`$WINDIR`](WINDIR.md) in the uninstaller. If you write the uninstaller to another location, you should keep the installer’s `$INSTDIR` in the registry or an alternative storing facility and read it in the uninstaller.

## History

[Section titled “History”](#history)

Added in NSIS v1.0

# $INTERNET_CACHE

> The directory that contains link objects that may exist in the Printers folder.

The directory that contains link objects that may exist in the Printers folder.

This constant is not available on Windows 95 and Windows 98.

## History

[Section titled “History”](#history)

Not documented

# $LANGUAGE

> The identifier of the language that is currently used. For example, English is 1033. You can change this variable in .onInit.

The identifier of the language that is currently used. For example, English is 1033. You can change this variable in [`.onInit`](../Callbacks/onInit.md).

## History

[Section titled “History”](#history)

Added in NSIS 2.0 Alpha 3

# $LOCALAPPDATA

> The local (nonroaming) application data directory.

The local (nonroaming) application data directory.

This constant is available on Windows 2000 and above.

## History

[Section titled “History”](#history)

Added in NSIS v2.07

# $MUSIC

> The user's music files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current…

The user’s music files directory. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is available on Windows XP, ME and above.

## History

[Section titled “History”](#history)

Not documented

# $NETHOOD

> The directory that contains link objects that may exist in the My Network Places/Network Neighborhood folder.

The directory that contains link objects that may exist in the My Network Places/Network Neighborhood folder.

This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.

## History

[Section titled “History”](#history)

Not documented

# ${NSIS_MAX_STRLEN}

> NSIS maximum string length used to build the script. The default is 1024 bytes, the special build's string lenght is 8192 bytes.

NSIS maximum string length used to build the script. The default is 1024 bytes, the [special build](http://nsis.sourceforge.net/Special_Builds)’s string lenght is 8192 bytes.

## History

[Section titled “History”](#history)

Not documented

# ${NSIS_VERSION}

> NSIS version used to build the script.

NSIS version used to build the script.

## History

[Section titled “History”](#history)

Not documented

# ${NSISDIR}

> A symbol that contains the path where NSIS is installed. Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs etc.

A symbol that contains the path where NSIS is installed. Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs etc.

When compiled with support for keeping makensis and the data in the same place (the default on Windows), it is in the same place as makensis, on other platforms it is set at compile time (See the INSTALL file for info). In both instances you can modify it at runtime by setting the NSISDIR environment variable. See [section 3.1.3](http://nsis.sourceforge.net/Docs/Chapter3.html#3.1.3) for more info.

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Alpha 2

# $OUTDIR

> The current output directory (set implicitly via SetOutPath or explicitly via StrCpy, ReadRegStr, ReadINIStr, etc)

The current output directory (set implicitly via [`SetOutPath`](../Commands/SetOutPath.md) or explicitly via [`StrCpy`](../Commands/StrCpy.md), [`ReadRegStr`](../Commands/ReadRegStr.md), [`ReadINIStr`](../Commands/ReadINIStr.md), etc)

## History

[Section titled “History”](#history)

Added in NSIS v1.4 Beta

# $PICTURES

> The user's music files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current…

The user’s music files directory. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is available on Windows XP, ME and above.

## History

[Section titled “History”](#history)

Not documented

# $PLUGINSDIR

> The path to a temporary folder created upon the first usage of a plug-in or a call to InitPluginsDir. This folder is automatically deleted when the installer…

The path to a temporary folder created upon the first usage of a plug-in or a call to [`InitPluginsDir`](../Commands/InitPluginsDir.md). This folder is automatically deleted when the installer exits. This makes this folder the ideal folder to hold INI files for [InstallOptions](http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html), bitmaps for the splash plug-in, or any other file that a plug-in needs to work.

## History

[Section titled “History”](#history)

Not documented

# $PRINTHOOD

> The directory that contains link objects that may exist in the Printers folder.

The directory that contains link objects that may exist in the Printers folder.

This constant is not available on Windows 95 and Windows 98.

## History

[Section titled “History”](#history)

Not documented

# $PROFILE

> The user's profile directory. A typical path is C:\Documents and Settings\Foo.

The user’s profile directory. A typical path is `C:\Documents and Settings\Foo`.

This constant is available on Windows 2000 and above.

## History

[Section titled “History”](#history)

Not documented

# $PROGRAMFILES, $PROGRAMFILES32, $PROGRAMFILES64

> The program files directory (usually C:\Program Files but detected at runtime). On Windows x64, $PROGRAMFILES and $PROGRAMFILES32 point to C:\Program Files…

The program files directory (usually `C:\Program Files` but detected at runtime). On Windows x64, `$PROGRAMFILES` and `$PROGRAMFILES32` point to `C:\Program Files (x86)` while `$PROGRAMFILES64` points to `C:\Program Files`. Use `$PROGRAMFILES64` when installing x64 applications.

## History

[Section titled “History”](#history)

`$PROGRAMFILES32` and `$PROGRAMFILES64` added in NSIS 2.26

# $QUICKLAUNCH

> The quick launch folder for IE4 active desktop and above. If quick launch is not available, simply returns the same as $TEMP.

The quick launch folder for IE4 active desktop and above. If quick launch is not available, simply returns the same as [`$TEMP`](TEMP.md).

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# $RECENT

> The directory that contains shortcuts to the user's recently used documents.

The directory that contains shortcuts to the user’s recently used documents.

## History

[Section titled “History”](#history)

Not documented

# $RESOURCES

> The resources directory that stores themes and other Windows resources (usually C:\Windows\Resources but detected at runtime).

The resources directory that stores themes and other Windows resources (usually `C:\Windows\Resources` but detected at runtime).

This constant is available on Windows XP and above.

## History

[Section titled “History”](#history)

Not documented

# $RESOURCES_LOCALIZED

> The localized resources directory that stores themes and other Windows resources (usually C:\Windows\Resources but detected at runtime).

***

The localized resources directory that stores themes and other Windows resources (usually `C:\Windows\Resources` but detected at runtime).

This constant is available on Windows XP and above.

## History

[Section titled “History”](#history)

Not documented

***

# $SENDTO

> The directory that contains Send To menu shortcut items.

The directory that contains Send To menu shortcut items.

## History

[Section titled “History”](#history)

Added in NSIS v2.0 Release Candidate 1

# $SMPROGRAMS

> The start menu programs folder (use this whenever you want $STARTMENU\Programs). The context of this constant (All Users or Current user) depends on the…

The start menu programs folder (use this whenever you want `$STARTMENU\Programs`). The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# $SMSTARTUP

> The start menu programs / startup folder. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the…

The start menu programs / startup folder. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

## History

[Section titled “History”](#history)

Added in NSIS v1.0i

# $STARTMENU

> The start menu folder (useful in adding start menu items using CreateShortCut). The context of this constant (All Users or Current user) depends on the…

The start menu folder (useful in adding start menu items using [`CreateShortCut`](../Commands/CreateShortCut.md)). The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

## History

[Section titled “History”](#history)

Not documented

# $SYSDIR

> The Windows system directory (usually C:\Windows\System or C:\WinNT\System32 but detected at runtime).

The Windows system directory (usually `C:\Windows\System` or `C:\WinNT\System32` but detected at runtime).

## History

[Section titled “History”](#history)

Not documented

# $TEMP

> The system temporary directory (usually %APPDATA%\Local\Temp or C:\Windows\Temp but detected at runtime).

The system temporary directory (usually `%APPDATA%\Local\Temp` or `C:\Windows\Temp` but detected at runtime).

## History

[Section titled “History”](#history)

Not documented

# $TEMPLATES

> The document templates directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current…

The document templates directory. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

## History

[Section titled “History”](#history)

Not documented

# $VIDEOS

> The user's video files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current…

The user’s video files directory. The context of this constant (All Users or Current user) depends on the [`SetShellVarContext`](../Commands/SetShellVarContext.md) setting. The default is the current user.

This constant is available on Windows XP, ME and above.

## History

[Section titled “History”](#history)

Not documented

# $WINDIR

> The Windows directory (usually C:\Windows or C:\WinNT but detected at runtime).

The Windows directory (usually `C:\Windows` or `C:\WinNT` but detected at runtime).

## History

[Section titled “History”](#history)

Not documented
