[Bug] claude-vscode.terminal.open on Windows with PowerShell picks .cmd over .ps1 via PATHEXT
Description
When claudeCode.useTerminal is enabled on Windows, the VS Code extension's claude-vscode.terminal.open command resolves the claude binary using which() (npm package), which follows the Windows PATHEXT environment variable. Since PATHEXT includes .CMD but not .PS1 by default, which("claude") returns the path to claude.cmd instead of claude.ps1.
In PowerShell, the resulting command becomes & 'C:\Users\...\claude.cmd', which may fail or behave differently from running claude bare — letting PowerShell resolve it natively to claude.ps1.
Root Cause
In the bundled extension.js, the mme() function calls:
_c("claude", true) // which("claude", true)
On Windows, npm's which package iterates PATHEXT extensions. Typical PATHEXT:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
.PS1 is absent, so which never considers claude.ps1. If claude.cmd exists anywhere in PATH, it wins.
The result is passed to ume():
function ume(e, t, r) {
if (e !== "win32" || !t) return "claude"; // fallback works fine
if (r === "powershell") return `& '${t}'`; // uses wrong binary
if (r === "cmd") return `"${t}"`;
return "claude";
}
If t is a path (the .cmd file), the fallback is never reached — PowerShell gets an explicit .cmd path instead of letting it resolve claude natively.
Expected Behavior
When the shell type is powershell, the command should let PowerShell resolve claude on its own (which correctly finds .ps1 files in PATH), either by:
- Skipping
which()resolution for PowerShell on Windows and passing bare"claude", or - Making
which()also consider.ps1when the target shell is PowerShell
Reproduction
- OS: Windows 11
- Extension version: 2.1.177
- Steps:
- Set
claudeCode.useTerminal: truein VS Code settings - Have
claude.cmdandclaude.ps1both inPATH(e.g.,%USERPROFILE%\bin) - Click "Claude Code: Open in Terminal" or press
Ctrl+Escape - The terminal runs
& 'C:\Users\...\claude.cmd'instead of resolving toclaude.ps1