为文件夹新增右键菜单

Posted on 2019-01-23 09:38  努力成长静待花开  阅读(136)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  Reistry类的SetValue

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Directory\\shell\\Open_Command","","在命令行打开");
            Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Directory\\shell\\Open_Command\\Command", "", "cmd.exe %1");
        }