Does this issue occur when all extensions are disabled?: Yes
VS Code Version: 1.126
OS Version: Windows 11 Enterprise (26200)
Steps to Reproduce
- On Windows, install VS Code (Stable), then install a fork such as Cursor or VSCodium that ships its own
code / code.cmd shim on PATH.
- The fork's
code.cmd ends up earlier on PATH (Cursor's installer prepends its bin dir).
- From any terminal, run:
code --install-extension ms-python.python
- The extension installs into the fork's extension directory (
%USERPROFILE%\.cursor\extensions\), not VS Code's (%USERPROFILE%\.vscode\extensions\). Same command was intended to target VS Code.
The problem
code on Windows is a code.cmd shim that unconditionally invokes Code.exe --ms-enable-electron-run-as-node <cli.js> from the directory it lives in. When multiple VS Code-family editors are installed, the CLI has no way to say "install into VS Code Stable's extension host specifically" other than fully qualifying the path to the correct code.cmd.
This bites in three real workflows:
- Automation scripts (dotfiles,
install-extensions.ps1, CI runners) that assume code --install-extension targets VS Code — they silently install to whichever fork's shim won the PATH race.
- Corp-managed machines where VS Code was installed by SCCM/Intune and a user later installed Cursor — the fork wins because it prepends
PATH in user scope.
- Fresh laptop bootstrap —
code --list-extensions > extensions.txt on the old machine, Get-Content extensions.txt | ForEach-Object { code --install-extension $_ } on the new one, and the extensions land in the wrong editor.
There is no diagnostic — the fork's CLI happily accepts VS Code extension IDs. The user only notices when the extensions don't appear in VS Code.
Proposal
Add one or more of:
(a) --target flag on the CLI (code --install-extension <id> --target stable | insiders | <absolute path>) that resolves to the correct extension host regardless of which shim was invoked. Default = the shim's own host (today's behaviour).
(b) Print a one-line banner when the invoked code.cmd belongs to a non-Microsoft fork, e.g. note: 'code' resolved to Cursor at C:\Users\...\AppData\Local\Programs\cursor\bin\code.cmd. Users could then re-run with a fully qualified path. Low-risk, no config surface added.
(c) Environment variable VSCODE_CLI_TARGET=stable|insiders|/abs/path that a wrapper script or user profile can set to disambiguate. Same effect as (a) without a new flag.
Even just (b) — printing the resolved shim path when a fork owns code — would save hours of "why isn't my extension loading" debugging.
Related but not duplicate
Searched issue tracker for code CLI install-extension fork, code shim PATH conflict, code --install-extension wrong binary — no existing report. Happy to close if I missed one.
Does this issue occur when all extensions are disabled?: Yes
VS Code Version: 1.126
OS Version: Windows 11 Enterprise (26200)
Steps to Reproduce
code/code.cmdshim onPATH.code.cmdends up earlier onPATH(Cursor's installer prepends itsbindir).%USERPROFILE%\.cursor\extensions\), not VS Code's (%USERPROFILE%\.vscode\extensions\). Same command was intended to target VS Code.The problem
codeon Windows is acode.cmdshim that unconditionally invokesCode.exe --ms-enable-electron-run-as-node <cli.js>from the directory it lives in. When multiple VS Code-family editors are installed, the CLI has no way to say "install into VS Code Stable's extension host specifically" other than fully qualifying the path to the correctcode.cmd.This bites in three real workflows:
install-extensions.ps1, CI runners) that assumecode --install-extensiontargets VS Code — they silently install to whichever fork's shim won thePATHrace.PATHin user scope.code --list-extensions > extensions.txton the old machine,Get-Content extensions.txt | ForEach-Object { code --install-extension $_ }on the new one, and the extensions land in the wrong editor.There is no diagnostic — the fork's CLI happily accepts VS Code extension IDs. The user only notices when the extensions don't appear in VS Code.
Proposal
Add one or more of:
(a)
--targetflag on the CLI (code --install-extension <id> --target stable | insiders | <absolute path>) that resolves to the correct extension host regardless of which shim was invoked. Default = the shim's own host (today's behaviour).(b) Print a one-line banner when the invoked
code.cmdbelongs to a non-Microsoft fork, e.g.note: 'code' resolved to Cursor at C:\Users\...\AppData\Local\Programs\cursor\bin\code.cmd. Users could then re-run with a fully qualified path. Low-risk, no config surface added.(c) Environment variable
VSCODE_CLI_TARGET=stable|insiders|/abs/paththat a wrapper script or user profile can set to disambiguate. Same effect as (a) without a new flag.Even just (b) — printing the resolved shim path when a fork owns
code— would save hours of "why isn't my extension loading" debugging.Related but not duplicate
Searched issue tracker for
code CLI install-extension fork,code shim PATH conflict,code --install-extension wrong binary— no existing report. Happy to close if I missed one.