From 59ba45aee4ea28ef73a6694e8bbe3dbbb19ff8e1 Mon Sep 17 00:00:00 2001 From: dulldesk <54601393+dulldesk@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:34:26 -0500 Subject: [PATCH] Update notes --- _notes/assoc-filetype.md | 2 +- _notes/context-menu.md | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 _notes/context-menu.md diff --git a/_notes/assoc-filetype.md b/_notes/assoc-filetype.md index 611d6ee..4062a32 100644 --- a/_notes/assoc-filetype.md +++ b/_notes/assoc-filetype.md @@ -1,7 +1,7 @@ --- title: Creating file extension associations date: 2020-05-17 -tags: [assoc, filetype, ftype] +tags: [assoc, filetype, ftype, cmd] --- ```batch diff --git a/_notes/context-menu.md b/_notes/context-menu.md new file mode 100644 index 0000000..5bfbddf --- /dev/null +++ b/_notes/context-menu.md @@ -0,0 +1,58 @@ +--- +title: Tweaking the Windows Context Menu +date: 2020-10-04 +tags: [explorer, regedit, registry, posh, "right click"] +--- + +For the Windows Explorer right click context menu. +Use the HKCR (`HKEY_CLASSES_ROOT`) path for administrator, +and HKCU (`HKEY_CURRENT_USER`) for only the current user. + +**Background of right panel** +``` +HKCR\Directory\Background\shell +HKCU\Software\Classes\directory\Background\shell +``` +**Directory icon** +``` +HKCR\Directory\shell +HKCU\Software\Classes\directory\shell +``` +**File** +``` +HKCR\*\shell +HKCU\Software\Classes\*\shell +``` + +### How to add a command (sample install script): + +If prompted, do not override keys unless it's for the command/knowledgable. +```powershell +$name = "Open with Sublime" +$cmd = """C:\Program Files\Sublime Text\subl.exe '%1'""" + +reg add HKCU\Software\Classes\Directory\Background\shell +reg add "HKCU\Software\Classes\Directory\Background\shell\$name" +reg add "HKCU\Software\Classes\Directory\Background\shell\$name" /d $cmd +``` +If manually adding via regedit, note that these are keys (not string values) + + +`%1` indicates the current file. [more args]({{ site.baseurl }}{% link _notes/assoc-filetype.md %}) + +Other paths to try: +``` +HKEY_CLASSES_ROOT\AllFileSystemObjects\ShellEx\ContextMenuHandlers +HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\ +HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\ +``` + +### Miscellaneous + +Windows 11 always expand context menu: +`reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /f` +(may need to restart Windows Explorer) + +[source](https://stackoverflow.com/questions/20449316/how-add-context-menu-item-to-windows-explorer-for-folders) +[MS-docs](https://docs.microsoft.com/en-us/windows/win32/shell/context-menu) +[another source](https://www.hongkiat.com/blog/manage-windows-context-menu/)