|
本帖最后由 hilsonma 于 2025-4-13 21:18 编辑
注册表添加右键菜单项
shell\项名称
菜单项的名称可使用名为 MUIVerb 的字符串值来定义,也可以使用默认值来定义,或者不做定义直接使用注册表项名称。
如果是定义子菜单,则添加名为 SubCommands 的字符串值,值的数据为空("").
如果要放在右键菜单底部,则添加名为 Position 的字符串值,值的数据为 "Bottom" (或者顶部 Top ,默认中间 Middle )
如果要显示图标,则添加名为 Icon 的字符串值,值的数据是图标路径如 "themecpl.dll,-1"
如果要在下一行显示分隔线,则添加名为 SeparatorAfter 的字符串值,值的数据为空("")
shell\项名称\command
默认值的数据填写要执行的命令
文件的右键菜单 位置在 HKCR\*
文件夹的右键菜单 位置在 HKCR\Directory\Background
桌面的右键菜单 位置在 HKCR\DesktopBackground
桌面其实是一个文件夹实例,所以,定义了文件夹的右键菜单,同样会在桌面右键显示。而定义桌面的右键菜单,只在桌面右键显示,其他文件夹右键不会显示。
---- 批处理示例 ----------------------------------------------
@echo off
reg add HKCR\Directory\Background\shell\电源 /v "SubCommands" /d "" /f
reg add HKCR\Directory\Background\shell\电源\Shell\重启\command /ve /d "shutdown.exe /r /t 0" /f
---- 注册文件示例 ----------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\电源]
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\电源\Shell\重启\command]
@="shutdown.exe /r /t 0"
|
|