[Bug] Windows shell commands fail without .cmd/.exe extension or cmd /c wrapper
Claude Code uses Git Bash as its shell on Windows, which doesn't properly execute Windows .cmd/.bat wrapper scripts. Commands like npm, npx, pnpm, az, and docker compose return empty output with no error, causing Claude to think commands succeeded when they didn't.
Steps to Reproduce:
Use Claude Code on Windows
Ask Claude to run npm --version or docker compose version
Command returns empty output (no error, no version)
Expected Behavior:
Commands should return their output, e.g., 10.8.2 for npm
Actual Behavior:
Empty output. Claude often doesn't realize the command failed and proceeds incorrectly.
Root Cause:
Git Bash doesn't perform Windows PATHEXT expansion. When you type npm, Windows CMD would automatically find npm.cmd, but Git Bash looks for a literal executable named npm and fails to execute the .cmd wrapper properly.
Current Workaround:
Users must document in CLAUDE.md to use explicit extensions (npm.cmd, docker.exe compose) or wrap commands in cmd /c "...". This must be repeated for every project and discovered independently by each Windows user.
Suggested Fixes:
Use CMD or PowerShell as the default shell on Windows instead of Git Bash
Add Windows-specific handling to automatically append .cmd/.exe extensions
Include this workaround in Claude Code's built-in system knowledge for Windows
Create proper shell shims during Claude Code installation on Windows
Impact:
Every Windows user of Claude Code encounters this issue and must independently discover and document the workaround. This significantly degrades the Windows experience and causes failed builds, incorrect assumptions, and wasted debugging time.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗