You just created a new folder in Windows Explorer. Right-click. You look for something that says Open with VS Code, Open with Cursor, Open with Windsurf... and it doesn't show up. Or worse: it shows up, you click it, and nothing happens.
It's a trivial workflow — create a folder, open it in your editor — but Windows makes it surprisingly hard in 2026. The recipes you find in blogs and Stack Overflow answers are five or six years old, and they skip two important changes: the redesigned Windows 11 context menu, and the way Electron-based editors handle their arguments.
This guide solves both problems. It works for any modern editor (VS Code, Cursor, Windsurf, VSCodium, and the forks that keep appearing) and needs no administrator permissions. At the end you'll have a right-click that opens the folder directly in your editor, on the first screen of the menu, without going through Show more options.
The native context menu doesn't work for folders
Windows has a built-in Open with... option — but only for files. For folders, the native menu gives you "Open", "Open in new window", "Pin to Quick access" and not much else. There's no official way to tell it "for folders, add this editor to the list".
The natural instinct is to look for a setting in the editor. But that setting doesn't exist on the editor side — the context menu is controlled by Windows, not the app. So we're going to register our own entry through the Registry.
Principle: the folder context menu is extended by the operating system, not by the application. If an editor adds it "automatically", it's writing to your Registry during installation.
The two Registry entries you actually need
There are two places in the Registry where Windows reads custom entries for folders:
HKCU\\Software\\Classes\\Directory\\shell\\<your-key>— appears when you right-click a folder in Explorer.HKCU\\Software\\Classes\\Directory\\Background\\shell\\<your-key>— appears when you right-click inside a folder (on the blank background), and opens that folder where you're standing.
Both are needed for full coverage. And both live under HKCU (current user) instead of HKLM (machine-wide), which means zero administrator permissions.
The other non-obvious detail: inside the command subkey, the variable that receives the path is %1 in Directory\\shell, but %V in Directory\\Background\\shell. Mixing them up is one of the reasons most recipes you find fail in one of the two cases.
Principle: two entries, two variables.%1for the click on the folder,%Vfor the click inside the folder.
Pitfall #1: in Windows 11, your entry is hidden
If you follow any pre-2022 tutorial, you'll register the entries correctly and won't see them when you right-click. That's because Windows 11 introduced a redesigned, shorter context menu with only five or six visible options. Everything else sits behind the Show more options button.
And here's the bad news: Microsoft only lets apps appear in that new menu if they're packaged as MSIX and register a modern shell extension implementing the IExplorerCommand COM interface. Traditional Registry entries — which are the only thing you can create from outside the editor's installer — necessarily live under Show more options.
This affects you even if the editor is installed correctly. VS Code, Cursor and most forks do not appear in the new Windows 11 menu — they all live behind Show more options. It's not a bug on your end; it's a Microsoft decision.
The fix is to disable the new menu and go back to the classic one (the Windows 10 one), where your custom entries appear next to the native ones on the first screen. It's done with a CLSID override:
$key = "HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\\InprocServer32"
New-Item -Path $key -Force | Out-Null
Set-ItemProperty -Path $key -Name "(Default)" -Value ""
Stop-Process -Name explorer -Force; Start-Process explorer
Honest trade-off: this change applies to all apps, not just your editor. You'll always see the classic menu. For many developers that's an upgrade — the new menu hides useful functionality — but decide consciously. It's reverted with a one-line command (at the end of the article).
Principle: Windows 11's new menu was designed to be short and curated. If you want to extend it, you have to go back to the classic one.
Pitfall #2: the environment variable that sabotages Electron editors
Modern Electron-based editors (VS Code and all its forks) internally use a variable called ELECTRON_RUN_AS_NODE. When it's 1, it tells the binary "don't open a window, run as Node.js and load the first argument as a module".
The problem: when you open the integrated terminal inside the editor, that terminal inherits ELECTRON_RUN_AS_NODE=1 from the parent process. If from that terminal you launch something that ends up running the editor binary — for example an agent that invokes the editor — the variable contaminates the new invocation. Typical result:
Error: Cannot find module 'C:\\Users\\You\\Folder'
at Module._resolveFilename ...
The editor is trying to load your folder as a Node package. The solution isn't to debug the calls; it's making sure the variable never reaches the editor binary when you launch it from the context menu. For that we use an intermediate launcher — a three-line .cmd that clears the variable before invoking the editor:
@echo off
setlocal
set ELECTRON_RUN_AS_NODE=
start "" "<full-path-to-editor.exe>" "%~1"
endlocal
The start "" does one more thing: it detaches the editor process from the Explorer process, so the cmd window running the launcher closes immediately instead of hanging around waiting for you to close the editor.
Principle: never call an Electron editor's binary directly from the Registry. Always go through a launcher that cleans the environment and detaches the process.
The --new-window flag can also betray you
It's tempting to add --new-window to the command to force every click to open a fresh window. The reality: some VS Code forks silently ignore the flag and, worse, in some cases break the IPC handshake with the already-running instance. Result: the command "does nothing".
The default behavior, with no flags, is reasonable: if no instance is running, it opens a fresh one; if one is, it reuses the window. If the reuse bothers you, that's an editor setting (in VS Code: window.openFoldersInNewWindow), not something you solve in the Registry.
Principle: the Registry decides "which binary to invoke and with which path". The window/instance behavior is controlled by the editor. Don't mix the layers.
Full recipe, ready to copy
Replace the two variables at the top (path to the executable, editor name) and run the whole block in PowerShell. It works the same for VS Code, Cursor, Windsurf, VSCodium and any other VS Code fork:
# --- Configure these two lines ---
$exe = "C:\\full\\path\\to\\editor.exe" # e.g.: "$env:LOCALAPPDATA\\Programs\\VS Code\\Code.exe"
$label = "Open with MyEditor" # text you'll see in the menu
$key = "MyEditor" # internal name (no spaces)
# -----------------------------------
$slug = $key.ToLower()
$launcher = "$env:USERPROFILE\\${slug}_launcher.cmd"
$vbs = "$env:USERPROFILE\\${slug}_launcher.vbs"
# 1) .cmd launcher that clears ELECTRON_RUN_AS_NODE and detaches with `start`
@"
@echo off
setlocal
set ELECTRON_RUN_AS_NODE=
start `"`" `"$exe`" `"%~1`"
endlocal
"@ | Set-Content -Path $launcher -Encoding ASCII
# 2) Invisible .vbs wrapper — wscript.exe is headless, removes the cmd flash
@"
Set sh = CreateObject(`"WScript.Shell`")
folder = WScript.Arguments(0)
cmd = `"`"`"$launcher`"`" `"`"`" & folder & `"`"`"`"
sh.Run cmd, 0, False
"@ | Set-Content -Path $vbs -Encoding ASCII
# 3) Entry for click on folder -> points to the .vbs, not the .cmd
$base1 = "HKCU:\\Software\\Classes\\Directory\\shell\\$key"
New-Item -Path $base1 -Force | Out-Null
Set-ItemProperty -Path $base1 -Name "(Default)" -Value $label
Set-ItemProperty -Path $base1 -Name "Icon" -Value "`"$exe`",0"
New-Item -Path "$base1\\command" -Force | Out-Null
Set-ItemProperty -Path "$base1\\command" -Name "(Default)" -Value "wscript.exe `"$vbs`" `"%1`""
# 4) Entry for click inside folder
$base2 = "HKCU:\\Software\\Classes\\Directory\\Background\\shell\\$key"
New-Item -Path $base2 -Force | Out-Null
Set-ItemProperty -Path $base2 -Name "(Default)" -Value $label
Set-ItemProperty -Path $base2 -Name "Icon" -Value "`"$exe`",0"
New-Item -Path "$base2\\command" -Force | Out-Null
Set-ItemProperty -Path "$base2\\command" -Name "(Default)" -Value "wscript.exe `"$vbs`" `"%V`""
# 5) Windows 11 classic menu (entry visible on the first screen)
$clsid = "HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\\InprocServer32"
New-Item -Path $clsid -Force | Out-Null
Set-ItemProperty -Path $clsid -Name "(Default)" -Value ""
# 6) Restart Explorer
Stop-Process -Name explorer -Force; Start-Process explorer
Try it with a right-click on any folder. You won't see any console flash — the chain wscript → .vbs → .cmd → editor is completely headless. The editor opens directly with the folder loaded, without intermediate windows.
Native editors don't need the .cmd launcher
This recipe uses an intermediate .cmd because Electron editors suffer from ELECTRON_RUN_AS_NODE. Native IDEs (Sublime Text, Notepad++, JetBrains IntelliJ) don't have that problem and accept paths directly as an argument. For them you can skip the .cmd, but it's still best to keep the .vbs to avoid any flash:
# For native editors, the .vbs invokes the .exe directly
@"
Set sh = CreateObject(`"WScript.Shell`")
folder = WScript.Arguments(0)
sh.Run `"`"`"$exe`"`" `"`"` & folder & `"`"`"`"`", 1, False
"@ | Set-Content -Path $vbs -Encoding ASCII
# (windowStyle=1 normal, because for native editors we do want to see the editor window)
The Win11 classic menu override is still needed if you want it on the first screen.
Ready-made prompt for your agent (the no-console option)
If you don't want to run PowerShell yourself — you're not technical, you don't feel like it, or you simply prefer to delegate — copy the prompt below and give it to your AI agent with access to your computer (Claude Code, Cursor Agent, Windsurf Cascade, GitHub Copilot Workspace, or any other that can run commands in your terminal).
The prompt is designed so the agent does absolutely everything: detects your editor, creates the launcher, registers the entries, enables the classic menu, restarts Explorer and confirms it works. You only have to tell it which editor you want to add.
I need you to add an "Open with <my editor>" option to the Windows 11 File Explorer context menu. I want to see the option when I right-click any folder, and also when I right-click the blank background inside a folder. The option must appear on the first screen of the menu, NOT hidden under "Show more options".
My editor is: <fill in: VS Code / Cursor / Windsurf / VSCodium / Sublime / etc.>
Canonical names to use (do NOT change them between runs):
- $key = internal Registry subkey name, no spaces
(e.g. "VSCode", "Cursor", "Windsurf").
- $label = text shown in the menu (e.g. "Open with VS Code").
- $launcher = "%USERPROFILE%\\${key_lowercase}_launcher.cmd"
IMPORTANT RULE — IDEMPOTENCY:
This prompt may run SEVERAL times on the same machine (because I run it again, because I update the editor, because you resume a broken session, or because I add DIFFERENT editors at different times). Your goal is not to "add entries" but to "leave the system in the correct state FOR THIS SPECIFIC EDITOR":
- If a previous installation of this editor already has the correct content: do NOT touch anything, only verify and report "already correct".
- If a previous installation of this editor has incorrect or outdated content (old .exe path because the editor updated, launcher with the --new-window bug, command pointing directly to the .exe without the launcher when the editor is Electron): overwrite the values in place — do not add a new key.
- If you find MULTIPLE keys for the SAME editor with different names (e.g. "VSCode", "VS_Code", "VsCode" created in earlier attempts): delete the extras and keep only the canonical key with the $key name I gave above.
- DO NOT TOUCH entries belonging to OTHER editors. If a "Cursor" key already exists and now I'm registering "VSCode", the Cursor one stays intact.
- Identify "installations of this editor" by matching: the (Default) contains the editor name, OR command\\(Default) references the editor executable or a launcher with its slug.
Please do all of this without asking me for confirmation between steps:
STEP 0 — PRELIMINARY DIAGNOSIS AND CLEANUP OF PARALLEL INSTALLATIONS
- List all subkeys under:
HKCU:\\Software\\Classes\\Directory\\shell\\
HKCU:\\Software\\Classes\\Directory\\Background\\shell\\
- For each subkey, read its (Default) and command\\(Default).
- Mark as "installation of THIS editor" any subkey whose (Default) or command points to the editor I'm registering now (matching by editor name or by path to its .exe/launcher).
- If there are marked subkeys with a name different from the canonical $key, DELETE them recursively (Remove-Item -Recurse).
- If the canonical $key subkey already exists, do NOT delete it yet — you will update it in place in step 3.
- Report to me what you found and what you deleted before continuing. DO NOT touch keys of OTHER editors or unrelated keys.
STEP 1 — DETECT THE EXECUTABLE
- Look for the editor's .exe in %LOCALAPPDATA%\\Programs, %ProgramFiles% and %ProgramFiles(x86)%.
- If you can't find it, resolve the Start menu shortcut with `Get-StartApps | Where-Object Name -match '<editor>'` and read the TargetPath of the .lnk with WScript.Shell.CreateShortcut.
- If it isn't found anywhere, abort with a clear message asking me for the manual path.
STEP 2 — WRITE THE .CMD LAUNCHER (idempotent: compare first)
- Canonical path: %USERPROFILE%\\${key_lowercase}_launcher.cmd
- Expected content (substituting the real .exe path detected in step 1):
@echo off
setlocal
set ELECTRON_RUN_AS_NODE=
start "" "<full_path_to_editor.exe>" "%~1"
endlocal
- If the file already exists, COMPARE its content with the expected content. If identical, do not write (avoids a new modification mark). If different — including the typical case where the editor was updated and the .exe path changed — overwrite it.
- The launcher is MANDATORY if the editor is Electron-based (VS Code, Cursor, Windsurf, VSCodium, Antigravity, Trae, etc.) because the ELECTRON_RUN_AS_NODE variable leaks from terminals opened inside the editor and breaks direct invocation of the .exe from the Registry.
- For native editors (Sublime Text, Notepad++, JetBrains) you may skip the launcher and put the .exe directly in the command of step 3 — but then do NOT create the .cmd, and if one exists from a previous installation, delete it.
STEP 2b — WRITE THE INVISIBLE VBSCRIPT WRAPPER (idempotent)
- Canonical path: %USERPROFILE%\\${key_lowercase}_launcher.vbs
- Why this wrapper: if the Registry invokes the .cmd directly, a black cmd.exe window flashes for ~200-300ms on startup. wscript.exe (the Windows VBScript engine) is headless by design and NEVER creates a console window. The .vbs simply invokes the .cmd from a wscript process, eliminating the flash completely.
- Expected .vbs content (3 functional lines):
Set sh = CreateObject("WScript.Shell")
folder = WScript.Arguments(0)
cmd = """" & sh.ExpandEnvironmentStrings("%USERPROFILE%") & _
"\\${key_lowercase}_launcher.cmd"" """ & folder & """"
sh.Run cmd, 0, False ' 0 = hidden window, False = don't wait
- If the .vbs already exists, compare content and overwrite only if it differs.
- For NATIVE EDITORS (Sublime, Notepad++, JetBrains) that don't need the .cmd launcher, still prefer a minimal .vbs that invokes the .exe directly:
Set sh = CreateObject("WScript.Shell")
folder = WScript.Arguments(0)
sh.Run """<path_to_exe>"" """ & folder & """", 1, False
(windowStyle=1 normal, because for native editors we do want the editor window to show.)
STEP 3 — REGISTER/UPDATE THE TWO ENTRIES IN HKCU (idempotent)
- Canonical key for click on a folder:
HKCU\\Software\\Classes\\Directory\\shell\\$key
(Default) = $label (e.g. "Open with VS Code")
Icon = "<path_to_exe>",0
command\\(Default) = wscript.exe "%USERPROFILE%\\${key_lowercase}_launcher.vbs" "%1"
- Canonical key for click on a folder's background:
HKCU\\Software\\Classes\\Directory\\Background\\shell\\$key
(Default) = $label
Icon = "<path_to_exe>",0
command\\(Default) = same but with "%V" instead of "%1"
- Use `New-Item -Force` and `Set-ItemProperty` — both are idempotent (they overwrite if the key/value exists).
- Before considering this step done, read the values back with `reg query` and verify they match the expected ones.
- IMPORTANT: the Registry command points to `wscript.exe + .vbs`, NOT directly to the .cmd or the .exe. The full chain for Electron editors is: wscript -> vbs -> cmd -> editor.exe. If you find a previous installation that invoked the .cmd directly from the Registry, UPDATE it to the wscript pattern (that old version produced a console flash — this one doesn't).
- %1 in the first, %V in the second. DO NOT use --new-window; some VS Code forks ignore it and break IPC. If a previous installation had --new-window, remove it.
STEP 4 — ENABLE THE WINDOWS 11 CLASSIC MENU (idempotent)
- Key: HKCU\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\\InprocServer32
- If it already exists with (Default) = "" (empty string), don't touch it and report "classic menu was already active".
- If it doesn't exist or has another value, create/overwrite it with (Default) = "" (empty string).
- This removes ALL custom entries from "Show more options" and places them on the first screen — it is not exclusive to this editor. Explicitly remind me of this consequence in the final report.
STEP 5 — RESTART EXPLORER (always)
- Stop-Process -Name explorer -Force; Start-Process explorer
- It's safe to do even if nothing changed — it takes 2 seconds and guarantees Explorer rereads the keys.
STEP 6 — FINAL VERIFICATION
- Confirm there is EXACTLY ONE $key key in each of the two context menu paths. If you ended up with duplicates for any reason, delete them.
- Show me, with `reg query`, the final values of the two entries and of the classic menu CLSID.
- Verify the launcher (if applicable) exists and ends with `endlocal`.
- Report an explicit summary of what you did:
a) Was it a new installation, an update (what changed: .exe path, command, etc.), or was everything already correct and you only verified?
b) If you cleaned up duplicate/legacy keys for this same editor, list which ones.
c) Detected editor version (if you can get it from the .exe).
- Tell me exactly what to test: right-click on a new folder that is NOT already open in the editor; the option should appear on the first screen, a brief cmd flash when clicking, and the editor opens with that folder loaded.
- Give me the exact command to revert everything if I ever want to uninstall it (including the case where we want to restore the new Win11 menu).
Run everything in PowerShell. Don't use loose .reg files. Don't ask me for confirmation between steps. If something fails, show me the actual error and propose the next step. Re-running this prompt a second time on the same machine for the SAME editor must be a no-op if everything is already correct, and a surgical correction if something drifted. Re-running it for a DIFFERENT editor must add the new editor without touching the entries of editors already installed.
Paste that block into your agent, fill in the two references between <...> (editor name and, optionally, the path if the agent can't find it on its own) and let it work. The whole process takes under 30 seconds on a normal machine.
Principle: a mature technical recipe should be deliverable as a prompt. If the agent can run and verify it without your intervention, the recipe is complete; if not, it still lacks detail.
Checklist and rollback
Before closing the session, verify:
- ✅ Right-click on a new folder → you see "Open with <YourEditor>" on the first screen.
- ✅ Right-click on the background of an open folder → the same option is there.
- ✅ When you click, the editor opens with the folder loaded — no console flash, everything invisible.
- ✅ You don't have to go through Show more options.
To revert everything when you no longer need it:
# Set $key to the same value you used above
$key = "MyEditor"
$slug = $key.ToLower()
Remove-Item "HKCU:\\Software\\Classes\\Directory\\shell\\$key" -Recurse -ErrorAction SilentlyContinue
Remove-Item "HKCU:\\Software\\Classes\\Directory\\Background\\shell\\$key" -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\\${slug}_launcher.cmd" -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\\${slug}_launcher.vbs" -ErrorAction SilentlyContinue
# Only if you want to go back to the new Win11 menu
Remove-Item "HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" -Recurse -ErrorAction SilentlyContinue
Stop-Process -Name explorer -Force; Start-Process explorer
The whole set — Registry entries, launcher, menu override — lives in HKCU and your user folder. It touches nothing in the system, requires no admin, and leaves no trace when you uninstall it. That's exactly the kind of customization worth doing: low cost, high daily return, reversible in five seconds.