Re: Tutorial: Add "Copy path to clipboard" into the rightclick file explorer context menu when saving files

Marion <[email protected]>
Newsgroups alt.comp.os.windows-10,alt.comp.os.windows-11,alt.comp.microsoft.windows
Organization BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID <[email protected]>
Herbert Kleebauer wrote:
> Don't right-click in the white space but on a folder. When you are in
> .....\temp9 right-click on temp10 before you enter temp10.

Hi Herbert,

This helps a lot. Thanks. It turns out that the common file dialog (used by
IrfanView and many other apps) doesn't always load the same handlers as the
native Windows File Explorer does, so custom entries often need explicit
registry tweaks to appear there (which is why I think the tutorial needed).

You've helped me a lot over the years, where I'm still using your Balabolka
TTS spell speaker that teaches the spelling of all the redsquiggled words.

I also use your timezone randomizer and the script that hides the console
when I use adb to bring up a scrcopy window of Android on Windows.

Hence I much appreciate that you always strive to add value to the ng.

To your point, I had not ever thought about rightclicking on a folder,
which, when I just did it now, brings up yet another DIFFERENT menu than
when clicking in white space in the modern app's "File > Save as..." GUI.
 <https://i.postimg.cc/rmjz2QxH/rightclick-on-folder.jpg>

Note all three menus are different (e.g., the rightclick on a folder inside
the "Irfanview:File > Save as..." has an "Open Admin Command Window Here".

What's the same as that Irfanview folder rightclick is if I rightclick on
any folder in the File Explorer (which I could tell because my custom 
"Open Admin Command Windows Here" was installed long ago for that purpose).

This makes sense when we dig down a bit to think about why this is so.

Windows context menus are generated by the shell based on the type of
object you right-click (background vs. folder vs. file), the host
environment (Explorer vs. common file dialog), and the registered shell
extensions that hook into those objects.

1. Right-click on the Windows 10 desktop or File Explorer white space
a. This invokes the background context menu for the current folder.
b. It's controlled by registry keys like:    
   HKEY_CLASSES_ROOT\Directory\Background\shell
c. Items here include things like View, Sort by, New, 
   and any shell extensions registered for folder backgrounds.

2. Right-click in the white space of IrfanView's "Save As" dialog
a. This isn't File Explorer proper as it's a common file dialog 
   (which is a Windows system control hosted inside IrfanView).
b. The dialog uses a different shell view implementation with 
   its own pared-down context menu.
   HKEY_CLASSES_ROOT\Directory\Background\shell
c. Many third-party shell extensions don't load here for stability
   and security reasons, so the menu looks different.

3. Right-click on a folder (in Explorer or in the Save As dialog)
a. This invokes the folder object's context menu.
b. The dialog is controlled by registry keys like:
   HKEY_CLASSES_ROOT\Directory\shell and     
   HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers
c. Items here include Open, Open in new window, Pin to Quick Access,
   plus third-party handlers (e.g., compression tools, version control).

However, all that having been said, I think the tutorial still adds immense
value since with it we can do all 3 things which we can't do without it.
   Rightclick: [Copy Path to Clipboard]
               [Open CLI Window Here]
               [Open File Explorer Here]

All of which were created by the following registry files:
 Windows Registry Editor Version 5.00

 ; --- Open File Explorer Here ---
 [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenExplorerHere]
 @="Open File Explorer Here"
 "Icon"="imageres.dll,-5302"

If needed, here's a reg file that adds all three efficiency tweaks:
 a. Open Command Window Here
 b. Open File Explorer Here
 c. Copy Path to Clipboard

  Windows Registry Editor Version 5.00
  
  ; --- Open File Explorer Here ---
  [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenExplorerHere]
  @="Open File Explorer Here"
  "Icon"="imageres.dll,-5302"
  [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenExplorerHere\command]
  @="explorer.exe %V"
  
  ; --- Open Command Window Here ---
  [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
  @="Open CLI Window Here"
  "Icon"="imageres.dll,-5324"
  [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
  @="cmd.exe /k cd /d %V"
  
  ; --- Copy Path to Clipboard ---
  [HKEY_CLASSES_ROOT\Directory\Background\shell\CopyPath]
  @="Copy Path to Clipboard"
  "Icon"="imageres.dll,-5302"
  [HKEY_CLASSES_ROOT\Directory\Background\shell\CopyPath\command]
  @="cmd.exe /c echo \"%V\" | clip"

These entries appear consistently in Explorer and in common file dialogs
(like IrfanView's Save As), because both environments query the same
Directory\Background\shell keys.

This tutorial effectively unified the menus across contexts, which solves
the inconsistency problems all noticed between the methods. The beauty is
that these commands are lightweight, don't require extra software, and
leverage built-in Windows tools.

Note that on Windows 11, context menu handling changed (with the 'Show more
options' layer), so these entries still work but may be tucked under the
legacy menu.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.