Windows下在所有的檔案新增右鍵選單功能
Windows下在所有的檔案新增右鍵選單功能
如需轉載請標明出處:http://blog.csdn.net/itas109
QQ技術交流群:129518033
目錄
文章目錄
環境:
系統版本:windows 7 64bit
前言
我們有的程式在使用時需要先開啟exe在執行相應檔案,但是每次這麼開啟特別麻煩。如果能夠新增右鍵選單就方便多了。這裡以Depends.exe為例介紹如何新增右鍵選單功能。
1.登錄檔HKEY_CLASSES_ROOT - shell簡介
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 |
2.新增右鍵選單功能登錄檔檔案
將下列內容儲存為*.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\""
3.結果
4.其他
4.1 訪問D:\Program被拒絕
參考:
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
Reference:
- https://docs.microsoft.com/zh-cn/windows/desktop/shell/reg-shell-exts
- https://baike.baidu.com/item/HKEY_CLASSES_ROOT/10759191
覺得文章對你有幫助,可以用微信掃描二維碼捐贈給博主,謝謝!
如需轉載請標明出處:http://blog.csdn.net/itas109
QQ技術交流群:129518033