Skip to content

Instantly share code, notes, and snippets.

@tmr232
Created October 4, 2022 17:14
Show Gist options
  • Save tmr232/2edad02213c0e1ebca98649916d62469 to your computer and use it in GitHub Desktop.
Save tmr232/2edad02213c0e1ebca98649916d62469 to your computer and use it in GitHub Desktop.
Adding an option to the context menu of a folder in Windows, via the registry.

Edit the example.reg file to suit your needs by changing the following:

  1. In line 3, Example is the name of the registry key. It can be whatever you want, but must match the path in line 6.
  2. In line 4 change the string to whatever you want to see in the right-click menu. Use & before the letter to use as a hotkey (underscored in the menu)
  3. Line 7 contains the command you want to run. %1 will be replaced with the path to the folder you right-clicked.

Lastly, if you want it to be per-user and not global, replace HKEY_CLASSES_ROOT with HKEY_CURRENT_USER\SOFTWARE\Classes.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\Example]
@="Command &Name"
[HKEY_CLASSES_ROOT\Folder\shell\Example\command]
@="cmd.exe /k echo %1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment