After the article is published on Habré, we add our
own commands to the context menu of the Explorer. Letters periodically come to me in which the authors asked me to explain why the added commands do not appear in the context menus of the Computer or Trash folders, although some programs somehow manage to add their own commands.
The questions are quite natural, and I myself asked myself similar questions several years ago when I studied the Windows registry. In order not to respond to every letter, I decided to write a small continuation on the context menu in Windows.
First you need to understand that, despite certain similarities with folders, Computer and Recycle Bin are special Windows objects with special properties. In fact, there are several hundred such objects in the Windows system. The Windows registry has a special CLSID key, which is located in the HKEY_CLASSES_ROOT branch. If you enter this section, you will see that it contains incomprehensible sections consisting of a set of numbers that are surrounded by curly braces. These are class identifiers (Class ID or CLSID), which are a sixteen byte number. For simplicity, you can think of this number as a phone number. As the telephone number corresponds to one person, so the CLSID number corresponds to a particular object.
')
Let's get down to business. So, to add a new command to the context menu of the Computer icon (formerly My Computer), you need to find its identifier and add a new subsection in its shell section. The Computer object corresponds to the identifier
{20D04FE0-3AEA-1069-A2D8-08002B30309D} . Thus, to add your command to the context menu of the
Computer object, you need to create a new section (for example, Notepad) in the
HKCR \ CLSID \ {20D04FE0-3AEA-1069-A2D8-08002B30309D} \ shell section, which will be displayed in the menu. In the created section, create a subsection of
command , in which register the program to run in the default parameter. In our case, this will be the string notepad.exe.
As in the examples with folders, you can edit the default value for the created Notepad section to display a more convenient name (for example,
Start Notepad )
We check - we select the Computer object in any place (the Start button menu, the icon on the Desktop or in the Explorer) and make sure that the
Start Notepad command appears in the context menu.
A little linger on the context menu of the Computer. It is clear that if a third-party program has added its command to the Computer context menu, then you can delete it, knowing where to look for this command. But do not overdo it. For example, to remove the command
Management , it is not necessary to delete the subsection
Manage . It is enough to use the
NoManageMyComputerVerb parameter in the HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer section or use group policy (for more information about this parameter, refer
to the Windows Registry Electronic
Reference . In this case, you simply hide the unnecessary command in a safe way.
You can also hide the
Properties menu item from the Computer object context menu using the
NoPropertiesMyComputer parameter (also available in the electronic directory).
We do the same with the object
Basket . The
cart identifier is the number
{645FF040-5081-101B-9F08-00AA002F954E} . Register a new section for the CLSID with a subsection of
command . Instead of the annoying example with the launch of Notepad, I registered the
Go to Habr command with the launch of Google Chrome to the Habrahabr home page (C: \ Users \ tehnolog \ AppData \ Local \ Google \ Chrome \ Application \ chrome.exe http://habrahabr.ru) .
For completeness, I’ll add that to hide the Properties command in the context menu of the Recycle Bin, the
NoPropertiesRecycleBin parameter is
used .
The topic of the context menus in Windows is not exhausted. But I hope this material will remove some of the questions. Good luck!