I would like to get the list of windows explorer context menu entitites (verbs) and commands behind it. Something like this:
Open with notepad++ | C:\Program Files\NOtepad++\NppShell_06.dll
Add to archive | C:\Program Files\WinRAR\rarext.dll
Play with VLC | "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
--started-from-file --no-playlist-enqueue "%1"
and so on.
I've wrote PS script to get all commands from context menu (all the same I can do via C#):
$ErrorActionPreference= 'silentlycontinue'
Set-Location -LiteralPath HKLM:\SOFTWARE\Classes\*\shellex\ContextMenuHandlers;
$o = Get-ChildItem -LiteralPath HKLM:\SOFTWARE\Classes\*\shellex\ContextMenuHandlers;
foreach($obj in $o)
{
$prop = (Get-ItemProperty $obj.PSChildName).'(default)';
"-------------------------------------------------------------";
try
{
$obj.PSChildName;
$sub = (Get-Item -LiteralPath ("HKLM:\SOFTWARE\Classes\CLSID\" + $prop.ToString())).GetSubKeyNames();
foreach($s in $sub)
{
(Get-ItemProperty -LiteralPath ("HKLM:\SOFTWARE\Classes\CLSID\" + $prop.ToString() + "\" + $s)).'(default)';
}
}
catch
{}
}
Output:
-------------------------------------------------------------
ANotepad++64
C:\Program Files\Notepad++\NppShell_06.dll
-------------------------------------------------------------
EPP
C:\Program Files\Windows Defender\shellext.dll
10.0.14393.1198
-------------------------------------------------------------
Open With
C:\Windows\system32\shell32.dll
-------------------------------------------------------------
WinRAR
C:\Program Files\WinRAR\rarext.dll
........
There is script to get verbs for specific file:
$o = new-object -com Shell.Application
$folder = $o.NameSpace("C:\Users\User\Documents")
$file=$folder.ParseName("file.txt")
$file.Verbs() | select *
Output:
Application Parent Name
&Open
&Print
&Edit
Edit with &Notepad++
Check with Windows Defender...
&Add to archive...
Add &to "file.rar"
Compress and email...
Compress to "file.rar" and email
.....
So, I do not know how to combine these solutions. Is there some command/elegant way to do what I want?