简体   繁体   English

NSIS 安装程序默认为以前的启动首选项

[英]NSIS installer defaults to previous startup preferences

Im able to install application with NSIS installer and later I update TaskManager->Startup preferences to disabled.我能够使用 NSIS 安装程序安装应用程序,稍后我将 TaskManager->Startup 首选项更新为禁用。 After I uninstall and reinstall the application, Startup preferences defaults to previous user preference of "disabled".在我卸载并重新安装该应用程序后,启动首选项默认为以前的用户首选项“已禁用”。 I want the installer to enforce Enabled always after new install, so application startups on reboot.我希望安装程序在新安装后始终强制启用,以便应用程序在重新启动时启动。 How to achieve this with NSIS coding.如何使用 NSIS 编码实现这一点。

Thanks谢谢

I believe Microsoft wants this to be a purely user-controlled setting, but in any case the method Task Manager uses is to modify the appropriate REG_BINARY value in the following registry locations in either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, as appropriate:我相信微软希望这是一个纯粹的用户控制设置,但在任何情况下任务管理器使用的方法是修改 HKEY_CURRENT_USER 或 HKEY_LOCAL_MACHINE 中以下注册表位置中适当的 REG_BINARY 值,视情况而定:

SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run
SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32
SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder

Enabled items contain the data:启用的项目包含数据:

02 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00

or要么

06 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00

Disabled items contain data starting with 03000000... or 07000000... and followed by some hex values [perhaps it's a timestamp?], eg:禁用的项目包含以 03000000... 或 07000000... 开头的数据,后跟一些十六进制值 [也许是时间戳?],例如:

03 00 00 00 F4 0B 28 C9 9D 79 D1 01 03 00 00 00 F4 0B 28 C9 9D 79 D1 01

I'm unclear what the distinction is between the ones that start with 02 and 06, but it seems 02s become 03s and 06s becomes 07s when disabled.我不清楚以 02 和 06 开头的那些之间有什么区别,但似乎 02s 变成 03s 而 06s 变成 07s 时禁用。

To ensure your startup item is enabled, either use WriteRegBin to set it back to 020000000000000000000000 or 060000000000000000000000, or just use DeleteRegValue and delete the value entirely.为确保您的启动项已启用,请使用WriteRegBin将其设置回 020000000000000000000000 或 060000000000000000000000,或者仅使用DeleteRegValue并完全删除该值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM