nsis 卸载程序不删除电子应用程序的注册表 - nsh 脚本
nsis uninstaller not deleting registry for electron app - nsh script
我已将我的 Electron 应用设置为在 windows 自动启动:
app.setLoginItemSettings({
openAtLogin: true,
path: process.execPaths
})
这会在注册表中的 Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\electron.app my app
位置添加一个条目
我正在使用 electron-builder 打包我的应用程序。
提到there可以在卸载nsis时添加脚本installer.nsh
这是我的习惯 installer.nsh:
!macro customUnInstall
SetRegView 64
DeleteRegKey /ifempty SHCTX "Software\Microsoft\Windows\CurrentVersion\Run\electron.app.my app"
SetRegView 32
DeleteRegKey /ifempty SHCTX "Software\Microsoft\Windows\CurrentVersion\Run\electron.app.my app"
!macroend
最后,我在 package.json 中提到了它:
"nsis": {
"runAfterFinish": true,
"createDesktopShortcut": true,
"deleteAppDataOnUninstall": true,
"include": "build/installer.nsh"
}
但是,当我卸载我的应用程序时,条目仍然留在注册表中。
如何删除这个条目?
DeleteRegKey
删除键,但我猜你的 运行 条目实际上是 a value。使用 DeleteRegValue
删除值:
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "electron.app my app"
为什么要使用 SHCTX?如果您知道它总是写入 HKEY_CURRENT_USER.
,请使用 HKCU
我已将我的 Electron 应用设置为在 windows 自动启动:
app.setLoginItemSettings({
openAtLogin: true,
path: process.execPaths
})
这会在注册表中的 Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\electron.app my app
我正在使用 electron-builder 打包我的应用程序。
提到there可以在卸载nsis时添加脚本installer.nsh
这是我的习惯 installer.nsh:
!macro customUnInstall
SetRegView 64
DeleteRegKey /ifempty SHCTX "Software\Microsoft\Windows\CurrentVersion\Run\electron.app.my app"
SetRegView 32
DeleteRegKey /ifempty SHCTX "Software\Microsoft\Windows\CurrentVersion\Run\electron.app.my app"
!macroend
最后,我在 package.json 中提到了它:
"nsis": {
"runAfterFinish": true,
"createDesktopShortcut": true,
"deleteAppDataOnUninstall": true,
"include": "build/installer.nsh"
}
但是,当我卸载我的应用程序时,条目仍然留在注册表中。
如何删除这个条目?
DeleteRegKey
删除键,但我猜你的 运行 条目实际上是 a value。使用 DeleteRegValue
删除值:
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "electron.app my app"
为什么要使用 SHCTX?如果您知道它总是写入 HKEY_CURRENT_USER.
,请使用 HKCU