好久没有记录一些东西了,现整理了一点添加右键菜单到系统菜单里,并读取出所选中的文件路径,方便大家,谢谢 private void button1_Click(object sender, EventArgs e) { string menuName = "测试"; //注册到所有文件 RegistryKey shell = Registry.ClassesRoot.OpenSubKey(@"*/shell", true); RegistryKey custom = shell.CreateSubKey(menuName); RegistryKey cmd = custom.CreateSubKey("command"); cmd.SetValue("", Application.ExecutablePath + " %1"); cmd.Close(); custom.Close(); shell.Close(); MessageBox.Show("注册成功!"); } private void button2_Click(object sender, EventArgs e) { string menuName = "测试"; RegistryKey reg = Registry.ClassesRoot.OpenSubKey(@"*/shell", true); try { if (reg != null) { Registry.ClassesRoot.DeleteSubKeyTree(@"*/shell/"+menuName); } MessageBox.Show("注销成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { reg.Close(); } 具体示例请到下载中心下载http://43720938.download.csdn.net/