With electron-builder NSIS installer we're able to create an executable installer which launches the installed electron app immediately after the install is finished. My question is is there a way to pass any command line parameters the installer itself was launched with to the installed app on this first launch?
I have seen some NSIS custom scripts which suggest that an executable can be launched with Exec
, and the installer parameters can be retrieved with GetParameters
. Is that a recommended direction, or is there some configuration option either in electron-builder or NSIS?
EDIT:
Here is a possible solution:
- set
nsis.runAfterFinish
electron-builder option to false (true is the default); implement
customInstall
event handler to customize the normal electron-builder provided template:!macro StartAppWithParameters Var /GLOBAL startAppWithParametersArgs ${if} ${isUpdated} StrCpy $startAppWithParametersArgs "--updated" ${else} StrCpy $startAppWithParametersArgs "" ${endif} ${StdUtils.GetAllParameters} $R0 0 ${StdUtils.ExecShellAsUser} $0 "$launchLink" "open" '$startAppWithParametersArgs $R0' !macroend !macro customInstall HideWindow !insertmacro StartAppWithParameters !macroend
Details are in electron-builder NSIS configuration, and electron-builder NSIS template
Thanks!