How to read a command line parameter given to an uninstaller?
Asked Answered
S

2

5

Using NSIS, how can I read a (optional) command-line parameter provided to an uninstaller?

I don't need to read it by name-- just reading the first parameter given could be enough.

Spatterdash answered 15/7, 2010 at 13:49 Comment(0)
C
7

Use the GetParameters and GetOptions helper functions in FileFunc.nsh (Included with NSIS)

Chive answered 15/7, 2010 at 13:59 Comment(0)
S
12

For anyone else's benefit, here's the actual code I used.

Program executed with parameter:

C:\path\to\program.exe -SELECT-DATA=FALSE

Then inside the uninstaller's un.onInit method:

Function un.onInit
  ${GetParameters} $R0
  ${GetOptions} $R0 "-SELECT-DATA=" $R1
  MessageBox MB_OK "Value read: $R1"
FunctionEnd

Will pop up a message box with the value: FALSE

Spatterdash answered 15/7, 2010 at 15:14 Comment(0)
C
7

Use the GetParameters and GetOptions helper functions in FileFunc.nsh (Included with NSIS)

Chive answered 15/7, 2010 at 13:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.