前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >windows注册表操作

windows注册表操作

作者头像
sofu456
发布2020-04-30 15:58:52
9670
发布2020-04-30 15:58:52
举报
文章被收录于专栏:sofu456sofu456

修改注册表

代码语言:javascript
复制
static void Register(string filePath)
        {
            if (!File.Exists(filePath)) Console.Out.WriteLine("parameter error");
            using (RegistryKey root = Registry.ClassesRoot)
            {
                string fileName = Path.GetFileNameWithoutExtension(filePath);
                using (RegistryKey register = root.CreateSubKey(@"*" + fileName))
                {
                    register.SetValue("icon", filePath);
                    register.SetValue(null, fileName);//默认值修改
                }
                using (RegistryKey register = root.CreateSubKey(@"*" + fileName + @"\command"))
                    register.SetValue(null, "\"" + filePath + "\" \"%1\"");
            }
        }

管理权限启动程序,否则注册表的修改无效

系统右键自定义

Registry.ClassesRoot下

  • *\shell\
  • DesktopBackground\shell\
  • Directory\Background\shell\

参考:https://blog.csdn.net/CrowNAir/article/details/78128566 http://www.winwin7.com/JC/14477.html

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 修改注册表
  • 系统右键自定义
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档