undefined
前言
Windows添加自定义右键菜单项
为文件添加自定义右键菜单项
文件本身右键
HKEY_CLASSES_ROOT\*\shell新建项
HKEY_CLASSES_ROOT\*\shell\新项修改默认值为右键菜单项名称
HKEY_CLASSES_ROOT\*\shell\新项新建字符串值Icon数据为图标的路径
- 自动截取可执行文件的图标将
Icon数据定义为可执行文件路径,0
HKEY_CLASSES_ROOT\*\shell\新项新建项,名为command
HKEY_CLASSES_ROOT\*\shell\新项\command修改默认值为执行的CMD命令
为文件夹添加自定义右键菜单项
普通文件夹本身右键
HKEY_CLASSES_ROOT\Directory\shell
普通文件夹内空白处右键
HKEY_CLASSES_ROOT\Directory\Background\shell
磁盘驱动器本身右键
HKEY_CLASSES_ROOT\Drive\shell
库本身右键
HKEY_CLASSES_ROOT\LibraryFolder\shell
任何类型文件夹本身右键
HKEY_CLASSES_ROOT\Folder\shell
案例
快捷方式文件本身右键打开文件所在位置
OpenFileLocation.reg1 2 3 4 5 6 7
| Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\lnkfile\shell\File Location] @="打开文件所在的位置"
[HKEY_CLASSES_ROOT\lnkfile\shell\File Location\command] @="explorer.exe /select,\"%1\""
|
普通文件夹内空白处右键打开命令行
OpenCMDHere.reg1 2 3 4 5 6 7 8
| Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCMDHere] @="OpenCMDHere" "Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCMDHere\command] @="cmd.exe /s /k pushd \"%V\""
|
OpenPowerShellHere.reg1 2 3 4 5 6 7 8
| Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHere] @="OpenPowerShellHere" "Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHere\command] @="powershell.exe -NoExit -NoProfile -Command \"Set-Location -LiteralPath \\\"%V\\\"\""
|
文件本身、普通文件夹本身、普通文件夹内空白处右键打开代码编辑器
OpenIDEAHere.reg1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\OpenIDEAHere] @="OpenIDEAHere" "Icon"="idea64.exe,0"
[HKEY_CLASSES_ROOT\*\shell\OpenIDEAHere\command] @="cmd.exe /s /c idea64.exe -e \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\OpenIDEAHere] @="OpenIDEAHere" "Icon"="idea64.exe,0"
[HKEY_CLASSES_ROOT\Directory\shell\OpenIDEAHere\command] @="cmd.exe /s /c idea64.exe \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenIDEAHere] @="OpenIDEAHere" "Icon"="idea64.exe,0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenIDEAHere\command] @="cmd.exe /s /c idea64.exe \"%V\""
|
OpenVSCodeHere.reg1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\OpenVSCodeHere] @="OpenVSCodeHere" "Icon"="%LocalAppData%\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\OpenVSCodeHere\command] @="cmd.exe /s /c code.cmd \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\OpenVSCodeHere] @="OpenVSCodeHere" "Icon"="%LocalAppData%\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\Directory\shell\OpenVSCodeHere\command] @="cmd.exe /s /c code.cmd \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenVSCodeHere] @="OpenVSCodeHere" "Icon"="%LocalAppData%\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenVSCodeHere\command] @="cmd.exe /s /c code.cmd \"%V\""
|
完成
参考文献
少数派——Tsan
CSDN——weixin_33882452
CSDN——「已注销」