Repository navigation
Releases
v1.1.3
v1.1.3 - console colour, screenshots, and a rewritten English README.
Added
- Console colour in the native executable. Component rows are white, detail rows dark
grey, and rows whose key name is space-padded are yellow - the single most important
thing to notice in the listing.-> DELETED, the deletion summary andExplorer is runningare green; failures are red.
Colour is applied only when stdout is a real console: redirected or piped output is
plain text with no escape codes, so capturing it from a script is unaffected.--no-color
forces plain text explicitly. --no-color.docs/ctxmenu-list.pnganddocs/ctxmenu-delete-flow.png- console previews rendered
from the program's real output, wording and colour scheme, with machine-specific install
paths replaced by%ProgramFiles%/%APPDATA%placeholders. Both READMEs show them.README.en.mdrewritten to mirror the Chinese README section for section: table of
contents, quick start, screenshots, consolidated FAQ, and the option reference moved out.
Changed
CtxMenuCleaner.exe --helpis regrouped into Usage / Options / Diagnostics / Misc /
Notes and now lists every option. The READMEs no longer duplicate that list - the binary
is the source of truth, with a Chinese table inreferences/exe.md.- Both READMEs restructured and trimmed. The interactive
YESstep is now described
explicitly in both, because skipping it silently cancels and looks exactly like "typing
the number did nothing". - The executable's internal version is now
1.1.3, matching the release. It had lagged
behind: it still reported1.0.0while the release wasv1.1.0.
Verified
- Redirected and piped output contains 0 ESC bytes - colour really is console-only.
- Every option claimed in
references/exe.md(19) appears in--help. - All anchors and relative links in both READMEs resolve, including the two image paths.
- Security scan of every file including the new PNGs: no credentials, no personal paths, no
host identifiers. --selftestleaves no probe key behind.
Notes
- The PowerShell scripts are unchanged from v1.1.2.
- The executable is still not committed: build it locally with
.\src\build.ps1 -Test.
Its HKLM deletion path under real elevation was exercised successfully on the test machine. - PowerShell 7+ remains designed-for but untested.
v1.1.2
v1.1.2 - documentation: the lessons-learned file.
Added
-
references/lessons-learned.md- every mistake made while building this project,
grouped by kind:Conclusions that turned out to be wrong (these cost the most time):
- A cleanup reported success while deleting nothing, because the lookup used an exact
key name that did not match the real, space-padded key. - A failed
reg importwas blamed on the Chinese comments in the.regfile. A
controlled test disproved it: ASCII-only, with Chinese comments, and with*plus a
padded key name all imported fine. The real failure was in our own test command. - Three successive wrong root causes were offered for one "my input was ignored"
symptom, before instrumentation showed the tool had been working all along and simply
required an explicitYESconfirmation.
Technical bugs:
Registry.OpenBaseKeynot existing on Windows PowerShell 5.1,
\scollapsing inside double-quoted paths, an invalid[regex]('\u...')pattern,
ConvertFrom-Jsonneither decoding\uXXXXnor enumerating arrays on 5.1,
ConvertTo-Json -InputObjectexpanding arrays, a licence file whose appended notice
broke GitHub's MIT detection, and an HTTP 400 fromInvoke-RestMethodonce a request
body passed roughly 75 KB.Omissions and process mistakes: a keyword list that missed a whole extension,
an undocumented confirmation step, two avoidable credential round-trips, testing an
interactive program without a timeout, and a stale process mistaken for a file lock. - A cleanup reported success while deleting nothing, because the lookup used an exact
-
Both READMEs and
SKILL.mdnow link to it.
Notes
- No code change. The executable and scripts are identical to v1.1.1.
- If a description in this repository disagrees with the code, the lessons file is the
place that explains why the mistake was made and what the correct behaviour is.
v1.1.1
v1.1.1 - the working native executable, plus a pre-release audit of the published content.
Added
CtxMenuCleaner.exe(src/CtxMenuCleaner.cs+src/build.ps1) - a native C# build compiled with the C# compiler bundled with Windows. It reads both registry views in ONE process through RegistryKey.OpenBaseKey, which Windows PowerShell 5.1 cannot do, so it removes the PowerShell version dependency entirely. Build with.\src\build.ps1 -Test.src/publish.ps1- maintainer tool: publishes a release through the GitHub REST API (create repo, upload files, tag, Release, topics) with no git installation required. Idempotent and re-runnable.src/release-notes.md- the release body, kept out of the script so the script source stays pure ASCII.references/exe.md- build, usage, and the measured non-ASCII-path limitation.
Fixed
- The native executable could not delete ANY key: every attempt failed with
OpenSubKey(writable) ... SecurityException HR=0x8013150A. The cause was not the deletion logic but the LAUNCH LOCATION. On the test machine a binary started from a Chinese-named, OneDrive-synced folder could not write to HKCU at all, while the identical binary copied to an ASCII path wrote fine.build.ps1now stages compilation in an ASCII-only temp directory and outputs to%LOCALAPPDATA%\CtxMenuCleaner\by default, and the exe gained--selftestto expose the condition. Verified: a 4-space-padded HKCU key is matched, backed up and deleted end to end. - The native executable discovered the same key twice, because
HKCU\SOFTWARE\Classesis one shared store that both registry views expose. Entries are now deduplicated by logical path, preferring the view that can actually write. - Interactive mode asked for elevation AFTER the user had already typed a selection, and
[y/N]defaults to N - so answering normally ended the run and looked like "typing 4 did nothing". Elevation is now decided once, up front; a pending--select Nis preserved across the re-launch and the prompt says so. - An answer containing no valid number was discarded as a quiet "Nothing selected." (exit 0), including a pasted command that reached ReadLine before the prompt was ready. It now reports the offending input and exits 1, distinguishing "you typed nothing" from "I could not understand what you typed".
- The
Type YES to confirm:step is now announced explicitly, since skipping it silently cancels. publish.ps1: passing a large body toInvoke-RestMethodproduced an HTTP 400 once the payload passed roughly 75 KB; requests are now sent over HttpWebRequest with explicit UTF-8 bytes. Also fixed a hard-coded release title and a wrong release-notes path.build.ps1: a running instance locks the executable it was started from. The build now detects that, moves the old binary aside and writes the new one, and keeps the staging directory when a build fails.--selftestnow states its one side effect before running it (it creates and removes a single throwaway key), and its probe key was renamed so it cannot be mistaken for a leftover test artefact.
Verified
- Every option listed in the README exists in the source, and no documented option is missing.
vendors.jsonholds exactly the 7 vendors / 25 patterns the README claims.- Security scan of all published files: no credentials, no personal paths, no temporary or build artefacts, no test leftovers, no host identifiers.
- The interactive flow was exercised end to end in a real elevated terminal: selection parsed,
YESconfirmed, two HKLM keys deleted with.regbackups written, Explorer restarted.
Notes
- The PowerShell tooling is unchanged from v1.0.0, apart from
LICENSEbeing restored to the plain MIT text so GitHub detects it as MIT. - The executable is not committed; build it locally. Its HKLM deletion path under real elevation was exercised successfully on the test machine.
- PowerShell 7+ remains designed-for but untested.
v1.0.0
First public release. PowerShell only - no compiled binary.
Tools
scripts/manage-context-menu.ps1- lists every Explorer context-menu component across both registry views, grouped by the owning DLL/executable, numbered and classified as third-party or Windows built-in. Pick by number and it removes all registrations of that component.scripts/remove-vendor-context-menu.ps1- pattern-driven removal configurable viascripts/vendors.json(7 vendors, 25 patterns).scripts/enumerate-context-menu.ps1- read-only audit that reveals the real registry key names, including space-padded ones.scripts/validate.ps1- self-check; no administrator rights needed.
Why this exists
Vendors pad the registry key name with leading spaces (" sgshellext"), so an exact-name delete matches nothing while reg still reports "The operation completed successfully." Apps also register both a static verb and a COM handler, and the 32-bit and 64-bit registry views are separate stores. This project handles all three causes, exports a .reg backup before every delete, and verifies each removal instead of trusting an exit code.
Verified on
Windows 10 Pro 22H2 (build 10.0.19045.6466) with Windows PowerShell 5.1.19041.6456, system locale zh-CN, ANSI code page 936. PowerShell 7+ is designed for but not tested. See the "Test environment" section in the README.
Notes
- Both English and Chinese documentation included (README.md / README.zh.md).
- No dependencies beyond Windows itself.
- A compiled native executable is under development in
src/and is not part of this release.