如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033
目录
环境:
系统版本:windows 7 64bit
我们有的程序在使用时需要先打开exe在执行相应文件,但是每次这么打开特别麻烦。如果能够添加右键菜单就方便多了。这里以Depends.exe为例介绍如何添加右键菜单功能。
HKEY_CLASSES_ROOT是应用程序运行时必需的信息,shell字键有个一”action“子键,如同”open“一样,这里有一个command子键;command子键有一个缺省句值,它包含了运行程序的命令行。将一个”open“子键放在一个对象类型的shell子键中会在这个对象类型的弹出菜单上多出一个”open“选项,给这个open子键一个command(缺省命令行"C:\Windows \Notepad.exe %1")子键会使得打开这个对象类型时使用笔记本做为缺省应用程序。其他操作选项包括View,Print,Copy,Virus,Scan等等。
下表给出了HKEY_CLASSES_ROOT的各个子项,可以在其下注册扩展处理程序。 请注意,许多扩展处理程序无法在所有列出的子项下注册。
子项 | 描述 | 可能的处理程序 |
---|---|---|
* | All files | Shortcut Menu, Property Sheet, Verbs (see below) |
AllFileSystemObjects | All files and file folders | Shortcut Menu, Property Sheet, Verbs |
Folder | All folders | Shortcut Menu, Property Sheet, Verbs |
Directory | File folders | Shortcut Menu, Property Sheet, Verbs |
Directory\Background | File folder background | Shortcut Menu only |
DesktopBackground | Desktop background (Windows 7 and higher) | Shortcut Menu, Verbs |
Drive | All drives in MyComputer, such as “C:” | Shortcut Menu, Property Sheet, Verbs |
Network | Entire network (under My Network Places) | Shortcut Menu, Property Sheet, Verbs |
Network\Type# | All objects of type # (see below) | Shortcut Menu, Property Sheet, Verbs |
NetShare | All network shares | Shortcut Menu, Property Sheet, Verbs |
NetServer | All network servers | Shortcut Menu, Property Sheet, Verbs |
network_provider_name | All objects provided by network provider “network_provider_name” | Shortcut Menu, Property Sheet, Verbs |
Printers | All printers | Shortcut Menu, Property Sheet |
AudioCD | Audio CD in CD drive | Verbs only |
DVD | DVD drive (Windows 2000) | Shortcut Menu, Property Sheet, Verbs |
将下列内容保存为*.reg。
注意:修改D:\Depends_cn\Depends.exe为需要程序的实际路径
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Depends]
@="Depends分析"
[HKEY_CLASSES_ROOT\*\shell\Depends\command]
@="\"D:\\Depends_cn\\Depends.exe\" \"%1\""
参考:
https://zhidao.baidu.com/question/13504107.html
故障现象:
所有未知格式文件打开的时候,则跳出“该文件拒绝访问”;当点鼠标右键直接选“打开方式”的时候也会弹出“该文件拒绝访问”警告窗口;如果右方已经有部分程序列表,则在点右侧次级菜单中的“选择程序”时跳出“该文件拒绝访问”的警告.
故障诊断:
未知格式文件打开方式关联被恶意修改.
解决方法:
把下面的代码放到记事本中去,改名为*.reg 文件,双击它就会把信息写进注册表,之后就解决问题了!
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Unknown]
"AlwaysShowExt"=""
"QueryClassStore"=""
[HKEY_CLASSES_ROOT\Unknown\shell]
@="openas"
[HKEY_CLASSES_ROOT\Unknown\shell\openas]
[HKEY_CLASSES_ROOT\Unknown\shell\openas\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,25,00,53,\
00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,\
79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,65,00,6c,00,6c,\
00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,4f,00,70,00,65,00,6e,00,41,00,\
73,00,5f,00,52,00,75,00,6e,00,44,00,4c,00,4c,00,20,00,25,00,31,00,00,00
echo off
title Dependency Walker 右键菜单管理
:主菜单
color 1B
cls
echo.*-----------------------------------------------------------------------------*
echo * *************************** 安装/卸载右键菜单 *******************************
echo.*-----------------------------------------------------------------------------*
echo.* *
echo.* (1) 安装右键菜单 *
echo.* *
echo.* (2) 卸载右键菜单 *
echo.* *
echo.*-----------------------------------------------------------------------------*
echo.* (A)安装 (U)卸载 (X)退出 *
echo.*-----------------------------------------------------------------------------*
echo.* 请在管理员下运行........... by Webenvoy (www.newasp.net) *
echo *******************************************************************************
SET /P runcd= 请输入()中的数字键并按回车 :
if /I "%runcd%"=="1" goto Installation
if /I "%runcd%"=="2" goto Uninstallation
if /I "%runcd%"=="A" goto Installation
if /I "%runcd%"=="U" goto Uninstallation
if /I "%runcd%"=="X" goto EX
goto 主菜单
:EX
exit
:Installation
cls
color 1B
REG ADD "HKCR\dllfile\shell\Open with Dependency Walker" /v "" /t REG_SZ /d "用 Dependency Walker 打开" /f
REG ADD "HKCR\dllfile\shell\Open with Dependency Walker" /v "Icon" /t REG_SZ /d "%cd%\depends.exe" /f
REG ADD "HKCR\dllfile\shell\Open with Dependency Walker\command" /v "" /t REG_SZ /d "%cd%\depends.exe \"%%1\"" /f
REG ADD "HKCR\exefile\shell\Open with Dependency Walker" /v "" /t REG_SZ /d "用 Dependency Walker 打开" /f
REG ADD "HKCR\exefile\shell\Open with Dependency Walker" /v "Icon" /t REG_SZ /d "%cd%\depends.exe" /f
REG ADD "HKCR\exefile\shell\Open with Dependency Walker\command" /v "" /t REG_SZ /d "%cd%\depends.exe \"%%1\"" /f
echo ***************************************************************************
echo.
echo 右键菜单安装完成......
echo.
echo ***************************************************************************
pause
exit
:Uninstallation
cls
color 1B
REG DELETE "HKCR\dllfile\shell\Open with Dependency Walker" /f
REG DELETE "HKCR\exefile\shell\Open with Dependency Walker" /f
echo ***************************************************************************
echo.
echo 右键菜单卸载完成......
echo.
echo ***************************************************************************
pause
exit
Reference:
觉得文章对你有帮助,可以扫描二维码捐赠给博主,谢谢!
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033