在 C# 中以编程方式添加没有管理员权限的文件关联 [英] Programmatically add file association without admin rights in C#

查看:60
本文介绍了在 C# 中以编程方式添加没有管理员权限的文件关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其他人也问过类似的问题,但我想澄清一下.我想在安装时无需管理权限即可构建我的应用程序.对于文件关联,我知道我需要在注册表中写入,但到目前为止我在 stackoverflow 文章中发现了两个不同的位置:

Other people have asked similar questions but I want to clarify. I want to build my application without the need for administrative permissions when installing. For the file association I understand that I need to write in the registry but so far I have found two different locations in stackoverflow articles:

HKEY_CURRENT_USER\Software\Classes

和另一个

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

那么哪个是正确的?

推荐答案

你应该使用前者 (HKCU\Software\Classes),因为这是 Windows 用来打开文件的.

You should use the former (HKCU\Software\Classes), because that's what Windows uses to open files.

我不确定第二个是做什么用的;我相信它仅用于填充打开方式"对话框的推荐部分.

I'm not sure what the second one is used for; I believe it's only used to populate the recommended section of the Open With dialog.

这篇关于在 C# 中以编程方式添加没有管理员权限的文件关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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