Add Windows Shell to the context menu for a specific extension (not file type)

To add the context menu of the Windows shell, say, for files .txt— if the extension .txtin HKEY_CLASSES_ROOT(or in HKEY_CURRENT_USER\Software\Classesdoesn’t really matter) has a default value (file type) txtfile- you add the command to HKEY_CLASSES_ROOT\txtfile\shell\yourcommand(and the command itself to HKEY_CLASSES_ROOT\txtfile\shell\yourcommand\command, of course), and there you go.

However, suppose the extension .txthas a default value Notepad++_file. Notepad++_filecan be a file type for many other extensions, so if you add a command to HKEY_CLASSES_ROOT\Notepad++_file, this command will appear for each extension associated with Notepad ++.

So, the question is : how to add a menu item for ONLY ONE specific extension without changing its file type, if at all possible?

PS: I do not want to simply duplicate the file type, because future changes to the original file type will not affect the duplicated one.

+4
source share
1 answer

Here you go:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\your custom app]
@="Open with your custom app"
"icon"="C:\\Windows\\notepad.exe,0"
"AppliesTo"=".nfo"

[HKEY_CLASSES_ROOT\*\shell\your custom app\command]
@="C:\\Windows\\notepad.exe \"%1\""

The line "AppliesTo"=".nfo"performs the trick.

Works fine on Windows 10.

It works for the file extension, regardless of whether the application associated with this extension exists or not . This makes it less invasive and leaves very little registry space.

Windows


Edit:

:

"AppliesTo"="System.FileName:\"*.nfo\" OR System.FileName:\"*.log\""

: https://superuser.com/questions/183785/windows-7-context-menu-for-folders-if-folder-contains-certain-filetypes

+7

Source: https://habr.com/ru/post/1523774/


All Articles