electron写注册表

新建build->installer.nsh

!macro customInstall
  # 写入注册表项
  WriteRegStr HKLM "Software\目录" "键" "$INSTDIR\aaa.exe"
!macroend

!macro customUnInstall
  # 卸载程序时删除注册表项
  DeleteRegKey HKLM "Software\目录"
!macroend

在pakeage.json中增加如下配置

"build": {
    "nsis": {
      "oneClick": false,
      "allowElevation": true,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true,
      "installerIcon": "build/installerIcon.ico",
      "uninstallerIcon": "build/uninstallerIcon.ico",
      "include": "./build/installer.nsh",
      "shortcutName": "应用程序名称",
      "language": "0x0804",
      "artifactName": "${productName}_Setup_${version}.${ext}"
    }
}
posted @ 2023-03-31 10:02  七星飘虫  阅读(168)  评论(0)    收藏  举报