Add, remove and block Windows right-click context menu entries from Python.
Project description
windowsctxmenu
Get your Windows right-click menu exactly the way you want it, from Python.
The idea: you write one script with your setup (what to remove, what to add, what to block) and carry it to every new PC or every reinstall. Run it and your context menu is identical everywhere — no manual registry editing.
Requirements
- Windows 11
- Python >= 3.10
Installation
pip install windowsctxmenu
API
from windowsctxmenu import (
add_shell, add_handler, unblock,
remove_shell, remove_handler, remove_shellnew, block,
)
| Function | What it does |
|---|---|
add_shell(name, command, ...) |
Add a classic verb under ...\shell |
add_handler(name, clsid, ...) |
Add a COM handler |
unblock(name_or_clsid) |
Unblock a blocked CLSID |
remove_shell(name, ...) |
Remove a classic verb |
remove_handler(name, ...) |
Remove a COM handler |
remove_shellnew(key_path) |
Remove an entry from the "New" submenu |
block(name_or_clsid) |
Block a built-in element by CLSID |
scope: file, directory, background, folder, drive, allfiles,
all, an extension (.zip), a ProgID glob (VLC.*), or sfa:<glob>.
Writing to HKLM (shared across users) requires running as administrator;
otherwise the action is reported as no-permission and continues.
Examples
Everything is in the examples/ folder:
examples/add.py— add entries (open folder with VS Code, PowerShell here, ...).examples/remove.py— full menu cleanup.
Copy one, tweak it to taste, and that's your per-PC script.
switchmenu command
Toggle the right-click menu between the classic (Windows 10) and the new
(Windows 11) one. Restarts Explorer to apply instantly. No administrator needed:
everything lives under HKEY_CURRENT_USER.
switchmenu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters