Electron-builder: NSIS Installer, make entry into registry (windows)

Created on 15 Nov 2017  路  2Comments  路  Source: electron-userland/electron-builder


  • Version: 19.24.1

  • Target: 2.15.0


I have NSIS Installer building from electron-builder and works fine. I can see App_Guid registry key as well. Now i have to make an entry into windows registry under certain path (e.g. HKLM/WOWXXX/CRDL/{APP_NAME} when installing installer.

How can I tweak the installer/build script to create registry entry when we install it?
Appreciate help.

Current installer.nsh

 !macro preInit
    SetRegView 64
    WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\ProgramData\CRDL\UFP"
    WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\ProgramData\CRDL\UFP"
    SetRegView 32
    WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\ProgramData\CRDL\UFP"
    WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\ProgramData\CRDL\UFP"
 !macroend
backlog

Most helpful comment

This is my intaller.nsh
_!macro customInstall
SetRegView 64
WriteRegStr HKCR "cloud" "" "URL:yunpan"
WriteRegStr HKCR "cloud" "URL Protocol" ""
WriteRegStr HKCR "cloudshell" "" ""
WriteRegStr HKCR "cloudshell\open" "" ""
WriteRegStr HKCR "cloudshell\open\command" "" '"$INSTDIR\cloud_app.exe" "%1"'
SetRegView 32
WriteRegStr HKCR "cloud" "" "URL:yunpan"
WriteRegStr HKCR "cloud" "URL Protocol" ""
WriteRegStr HKCR "cloudshell" "" ""
WriteRegStr HKCR "cloudshell\open" "" ""
WriteRegStr HKCR "cloudshell\open\command" "" '"$INSTDIR\cloud_app.exe" "%1"'
!macroend
!macro customUnInstall
DeleteRegKey HKCR "cloud"
!macroend
_
It resgists a URL Protocol called cloud when installing the app.

All 2 comments

This is my intaller.nsh
_!macro customInstall
SetRegView 64
WriteRegStr HKCR "cloud" "" "URL:yunpan"
WriteRegStr HKCR "cloud" "URL Protocol" ""
WriteRegStr HKCR "cloudshell" "" ""
WriteRegStr HKCR "cloudshell\open" "" ""
WriteRegStr HKCR "cloudshell\open\command" "" '"$INSTDIR\cloud_app.exe" "%1"'
SetRegView 32
WriteRegStr HKCR "cloud" "" "URL:yunpan"
WriteRegStr HKCR "cloud" "URL Protocol" ""
WriteRegStr HKCR "cloudshell" "" ""
WriteRegStr HKCR "cloudshell\open" "" ""
WriteRegStr HKCR "cloudshell\open\command" "" '"$INSTDIR\cloud_app.exe" "%1"'
!macroend
!macro customUnInstall
DeleteRegKey HKCR "cloud"
!macroend
_
It resgists a URL Protocol called cloud when installing the app.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings