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}"

}

}