自定义桌面右键快捷方式
的有关信息介绍如下:定义自己的桌面快捷方式
复制下面的内容,保存到文本,将文本txt 格式 改为bat 双击直接运行。
如果只是需要更改成自己的三个选项,可以直接更改中间部分引号内容,注意非系统应用需要添加完整路径。
@echo off
echo.
echo 请选择:
echo 添加注册表 删除注册表
echo.
set /p a= 请选择[1/2];
if %a% equ 2 (
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1 /f
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu2 /f
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu3 /f
call REG DELETE HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu /f
)
==========================================================
if %a% equ 1 (
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1" /ve /t Reg_SZ /D "编辑器" /f
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1\Command" /ve /t Reg_SZ /D "notepad.exe"
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu2" /ve /t Reg_SZ /D "计算器" /f
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu2\Command" /ve /t Reg_SZ /D "calc.exe"
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu3" /ve /t Reg_SZ /D "注册表" /f
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu3\Command" /ve /t Reg_SZ /D "regedit.exe"
==========================================================
call reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v MUIVerb /t Reg_SZ /d "快捷方式" /f
call reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v Position /t Reg_SZ /d "low" /f
start reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v SubCommands /t Reg_SZ /d "MyMenu1;MyMenu2;MyMenu3;MyMenu4" /f
)
说明:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell 新建快捷项的注册表位置在这里面。
HKEY_CLASSES_ROOT\Directory\Background\shell 新建桌面鼠标右键菜单项的注册表位置在这里面。
可以看到分为三个部分。
用 if 语句进行选择操作(即:如果选1进行xxx 操作,如果选2进行xxx操作)。
第一部分为需要删除时清理的注册表项目。
为了方便编辑,创建的快捷项目MyMenu1;MyMenu2;MyMenu3 以此类推便于操作。
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1 /f
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu2 /f
call REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu3 /f
下面这行则是清理桌面鼠标右键菜单栏的新建注册表项RuanMenu 的。
call REG DELETE HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu /f
第二部分为自定义的快捷方式项目。
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1" /ve /t Reg_SZ /D "编辑器" /f
新建了注册表项MyMenu1其中/ve /t Reg_SZ /D "编辑器" /f 用于强制指定默认项的值,其中“编辑器”为值得数值(即:自定义快捷方式的名称)。
call reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MyMenu1\Command" /ve /t Reg_SZ /D "notepad.exe"
则是在 MyMenu1下面新建了项 Command 而其中 /ve /t Reg_SZ /D "notepad.exe" 与上同理指定的数值为应用位置,如非系统应用则需要完整路径。
第三部分为自定义桌面右键快捷方式。
call reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v MUIVerb /t Reg_SZ /d "快捷方式" /f
这一句与前面相同,不过是显示在桌面鼠标右键选项上的。
call reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v Position /t Reg_SZ /d "low" /f
这一句定义了这个新建项在桌面鼠标右键上菜单的位置(low 代表中部,可以改成自己需要的位置,例如:top 等)。
start reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\RuanMenu" /v SubCommands /t Reg_SZ /d "MyMenu1;MyMenu2;MyMenu3;MyMenu4" /f
最后这一句则是将前面第二部分的自定义快捷方式项目,添加到桌面鼠标右键菜单项中。
数值 MyMenu1;MyMenu2;MyMenu3;MyMenu4 为自己在第二部分定义的项目,添加了的都在这一行加入,中间以;隔开。