nsis卸载程序未删除电子应用程序的注册表-nsh脚本 [英] nsis uninstaller not deleting registry for electron app - nsh script
问题描述
我已将电子应用设置为在Windows上自动启动:
I've set my electron app to auto-start on windows:
app.setLoginItemSettings({
openAtLogin: true,
path: process.execPaths
})
在位置计算机\HKEY_CURRENT_USER\软件\Microsoft\Windows\CurrentVersion\Run\electron.app我的应用程序中的注册表项
我正在使用 electron-builder 来打包我的应用。
I'm using electron-builder to package my app.
这里提到有我可以在卸载nsis时添加脚本 installer.nsh
。
It's mention there that I can add a script installer.nsh
at the time of nsis uninstallation.
这是我的自定义 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中提到了它:
And lastly, I mentioned it in package.json:
"nsis": {
"runAfterFinish": true,
"createDesktopShortcut": true,
"deleteAppDataOnUninstall": true,
"include": "build/installer.nsh"
}
但是,当我卸载时我的应用程序条目保留在注册表中。
But, still when I uninstall my app the entry is left in the registry.
如何删除此项?
推荐答案
DeleteRegKey
会删除密钥,但我猜您的运行条目实际上是一个值。使用 DeleteRegValue
删除值:
DeleteRegKey
deletes keys but I'm guessing your run entry is actually a value. Use DeleteRegValue
to delete values:
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "electron.app my app"
为什么要使用SHCTX?如果您知道总是将它写入HKEY_CURRENT_USER,请使用HKCU。
Why are you using SHCTX? Use HKCU if you know it is always written to HKEY_CURRENT_USER.
这篇关于nsis卸载程序未删除电子应用程序的注册表-nsh脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!