开发者

How to read a command line parameter given to an uninstaller?

开发者 https://www.devze.com 2023-01-07 02:31 出处:网络
Using NSIS, how can I read a (optional) command-line parameter provided to an uninstaller? I don\'t need t开发者_运维问答o read it by name-- just reading the first parameter given could be enough.For

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

I don't need t开发者_运维问答o read it by name-- just reading the first parameter given could be enough.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消