如何以编程方式更改文件关联,而不需要提升 [英] How to change file association programmatically without require elevation

查看:110
本文介绍了如何以编程方式更改文件关联,而不需要提升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户具有管理/提升权限(Win XP,Vista,7),如何以编程方式更改文件关联?关于如何解决这个问题的任何想法?基本上,我想像现在一样保持我的应用程序(它不需要更高的权限来安装和运行)。
此刻,我提供了一个GUI界面,用户可以在其中更改文件关联,但是如果用户的权限有限,那么它所做的就是显示一个消息,它不能做到这一点,并且向用户解释如何激活以管理员身份运行此程序框,然后重新启动程序。如果用户有权利,那么我只是更改关联。



有一个更好的方法来做,保持'lite'?

解决方案

在Windows(自Windows 2000)以来,您被允许拥有系统范围的文件关联,需要提升的权限才能设置和每个用户文件关联。



如果你想保持 lite ,请创建一个per_user文件关联,就是这样。

查看本文:文件类型和文件关联的更改Windows 2000和Windows Server 2003中的功能


How to change file association programmatically when the user does not have admin/elevated rights (Win XP, Vista, 7)? Any ideas about how to work around this? Basically I would like to keep my application as lite as it is now (it doesn't need elevated rights to install and run). At the moment I offer a GUI interface where the user can change the file association, but if the user has limited rights all it does is to show a message that it cannot do that and it explains to it how to activate the "Run this program as administrator" box then restart the program. If the user has the rights, then I just change the association.

There is a better way to do it and stay 'lite'?

解决方案

In Windows (since windows 2000) you're allowed to have system-wide file association, which require elevated privileges to be set, and per user file associations.

If you want to stay lite, make a per_user file association and that's it.

Take a look on this article: Changes in File Types and File Association Features in Windows 2000 and Windows Server 2003.

这篇关于如何以编程方式更改文件关联,而不需要提升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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