在安装过程中检查所有用户配置文件 [英] Going over all user profiles during installation

查看:39
本文介绍了在安装过程中检查所有用户配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 Windows 应用程序,该应用程序需要向发送至"资源管理器上下文菜单添加一个条目,并且需要为所有用户执行此操作.由于 Send-To 文件夹特定于每个用户,所有用户都没有通用文件夹,因此我有两个选择:

我可以查看所有用户配置文件以及默认用户配置文件,找到 SendTo 文件夹并向其添加快捷方式.这将确保在卸载过程中删除快捷方式.

或者,我可以确保每次用户登录时快捷方式都在 SendTo 文件夹中(通过将我的应用程序添加到所有用户的启动文件夹中).这会让我在安装过程中的生活轻松很多,但是当卸载应用程序时,所有这些快捷方式都不会被删除.

所以无论哪种方式,我都需要一种方法来找到所有用户的 SendTo 文件夹.我可以扫描 HKEY_USERS 并找到每个用户的 SendTo 文件夹(它可能不在默认位置,用户可以移动它),但是如何找到用户配置文件的根文件夹?对于 SendTo 文件夹,注册表中有类似 %USERPROFILE\AppData\Roaming... 的内容.如何确定其他用户的 %USERPROFILE% 是什么?

谢谢.

解决方案

更简单的方法:使用 exe 本身的启动顺序来检查它在启动时是否存在快捷方式,如果没有则创建它.

最好使用 ActiveSetup 处理所有用户的卸载,它会为每个登录计算机的用户运行一次可运行的东西".在您的情况下,一个简单的批处理命令就可以完成这项工作.

如果您确实选择了这种卸载方法,则必须确保您的 msi 安装程序检查此卸载密钥并在安装时将其删除 - 否则您将在用户下次登录时为快捷方式安排删除操作.

还要记住,每次安装都应在 ActiveSetup 中使用不同的条目,以确保为已卸载快捷方式的用户重新运行快捷方式创建.在您阅读有关 ActiveSetup 的更多信息之前,最后一部分可能有点难以理解:http://www.etlengineering.com/installer/activesetup.txt

I'm creating a Windows application that needs to add an entry to the Send-To explorer context menu, and needs to do so for all users. Since the Send-To folder is specific for each user, with no common folder for all users, I'm left with two choices:

I can go over all user profiles, as well as the default user profile, find the SendTo folder and add the shortcut to it. This will ensure the shortcut is deleted during uninstall.

Or, I can make sure the shortcut is in the SendTo folder each time a user logs in (by adding my application to the start-up folder of all users). This will make my life a lot easier during installation, but when the application is uninstalled, all those shortcuts will not be removed.

So either way, I need a way to find the SendTo folder of all users. I can scan HKEY_USERS and find the SendTo folder of each user (it might not be in the default location, the user can move it), but how do I find out the user profile's root folder? The registry has something like %USERPROFILE\AppData\Roaming... for the SendTo folder. How can I figure out what %USERPROFILE% is for another user?

Thanks.

解决方案

Easier approach: use the launch sequence of the exe itself to check whether the shortcut it present on launch, and create it if not.

Uninstall for all users is best handled using ActiveSetup which will run "something runnable" once for each user logging onto the machine. In your case a simple batch command could do the job.

If you do chose this uninstall approach, you must make sure that your msi installer checks for this uninstall key and deletes it on install - otherwise you have a delete operation scheduled for the shortcut the next time a user logs on.

Also keep in mind that each install should use a different entry in ActiveSetup to ensure that the shortcut creation is re-run for a user who has had it uninstalled already. This last part might be slightly incomprehensible before you read more about ActiveSetup: http://www.etlengineering.com/installer/activesetup.txt

这篇关于在安装过程中检查所有用户配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆