-1

I already have a nsis installer for my software. For supporting registration in silent installer (we have written complex logic in code rather than manipulating registry via nsis), i created an exe which accepts 2 parameters: RegName and RegKey for registration. Now I want to call this exe file with two parameters in silent installation and this call has to be optional and will depend if user has passed the two parameters.

So requirement boils down to :

-- Only process the key and registration name in silent installation -- call my exe if the overall installation went successfull

  • Please provide a [MCV example](https://stackoverflow.com/help/mcve) of your existing code, otherwise it's impossible to help you. If you don't have any code, StackOverflow is the wrong place to ask – try the NSIS forums instead! – idleberg Nov 03 '17 at 14:50

1 Answers1

0
OutFile "myinstaller.exe"
RequestExecutionLevel user

!include LogicLib.nsh
!include FileFunc.nsh


Function CheckRegistryParameters
${GetParameters} $0
${GetOptions} "$0" "/RegKey" $1
${GetOptions} "$0" "/RegName" $2
${If} $1 != ""
${AndIf} $2 != ""
    WriteRegStr HKCU "Software\Test\$1" "Name" "$2"
    Exec '"yourapplication.exe" "$1" "$2"'
${EndIf}
FunctionEnd

Section
${If} ${Silent}
    Call CheckRegistryParameters
${EndIf}
SectionEnd

and run as myinstaller.exe /S /RegKey "Hello" /RegName "World"

Anders
  • 97,548
  • 12
  • 110
  • 164