[BUG] CC native on Windows: not really shell aware

Open 💬 16 comments Opened Aug 3, 2025 by 0xeb

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.67
  • Operating System: Windows 11
  • Terminal: cmd.exe

Bug Description

On Windows native (no WSL), CC still makes a lot of errors trying to run essential commands:

● Bash(move *.md docs\)
  ⎿  Error: /usr/bin/bash: line 1: move: command not found

● Bash(move /Y *.md docs\)
  ⎿  Error: /usr/bin/bash: line 1: move: command not found

The above are but a few instances of errors where CC has to retry multiple times in order to re-orient itself and know under which environment it is.

Steps to Reproduce

Start dogfooding CC windows native internally. You will find all sort of errors at tool invocation and shell interaction levels.

Using or having to install Git Bash is out of question.

Expected Behavior

CC should know its environment and shell and work correctly

Actual Behavior

All sorts of shell commands invocation errors:

● Bash(move *.md docs\)
  ⎿  Error: /usr/bin/bash: line 1: move: command not found

● Bash(move /Y *.md docs\)
  ⎿  Error: /usr/bin/bash: line 1: move: command not found

etc.

Too many to list. I was not planning to file a bug, but this is too much now.

Additional Context

Please dogfood your own product (CC) on Windows and start to weed out low hanging fruit errors.

View original on GitHub ↗

16 Comments

TC23345 · 11 months ago

...its not you....its me....

● The issue is with Windows path escaping in JSON. Even with cchooks, the core problem remains: Claude Code v1.0.67 on Windows is not triggering hooks consistently.

Summary

We've now tried:

  1. Direct Python commands ❌
  2. PowerShell wrappers ❌
  3. WSL commands ❌
  4. uv run commands ❌
  5. Shell scripts with Git Bash ❌
  6. cchooks SDK ❌

All approaches work when run manually but fail because Claude Code isn't calling the hooks. This is confirmed by:

  • No new entries in debug logs when editing files
  • The hooks work perfectly when run manually
  • GitHub issue #3417 documenting this exact problem

The issue is not with our hook implementation - it's with Claude Code v1.0.67 not triggering hooks on Windows. Until this bug is fixed by the Claude Code team, manual execution remains the only reliable option.

CarlosGtrz · 11 months ago

I've had some luck adding this to C:\Users\[user]\.claude\CLAUDE.md, but it should be in the default knowledge of the windows version.

## File Operations
- Use `mv` instead of `move` (Git Bash doesn't recognize `move`)
- Enclose paths in quotes: `cd "c:\Projects\MyApp"`
- When redirecting to null, use uppercase: `command > NUL` (not `nul`)

## Script Execution
- PowerShell: Use `pwsh.exe -ExecutionPolicy Bypass -File "script.ps1"`
- PowerShell commands: Use `pwsh.exe -c "command"`
- To call PowerShell commands like Get-WinEvent use `pwsh.exe -c "Get-WinEvent"`
- Batch files: Use `cmd //c "script.bat"`

## Windows Commands in Git Bash
- Double-escape parameters starting with `/`: `taskkill //F //PID 1234`
- This applies to most native Windows utilities (taskkill, robocopy, etc.)
sebthom · 11 months ago

I also see funny things on Windows like:

Bash(cd /d D:\projects\project1 && dart test)
Error: cd to '/d D:projectsproject' was blocked. For security, Claude Code may only change directories
to child directories of the allowed working directories for this session: 'D:\projects\project1'.
github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5041
  2. https://github.com/anthropics/claude-code/issues/4122
  3. https://github.com/anthropics/claude-code/issues/5098

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

jtnord · 11 months ago

there are also issues when it attempts to run find and expects a gnu compatable tool not the windows find.exe (which is earlier in the path).

worked around with ``when attempting to run find you must use the command c:\cygwin\bin\find instead``

0xeb · 11 months ago

That's the problem with "Windows Native". It is a sloppy job.

The model should be finetuned to know how to use PowerShell and CMD shell natively. In CC's system prompt, inject the correct OS, so the model knows what tools and how to use them.

kasi-opstechnologysolutions · 9 months ago

Any updates on this? 2.0 release doesn't seem to improve/enhance the Windows native experience with powershell/pwsh in any noticeable way and it makes hooks all but unusable in any non trivial scenario.

jmasek · 7 months ago

Hi, any progress on this? ChatGPT user here, waiting for functional CC in Windows PowerShell 7 to give CC a chance.

github-actions[bot] · 6 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

ForNeVeR · 5 months ago

Claude still breaks often when combining Unix-style commands and Windows path separators, e.g. right now encountered a case when it tried to call

● Bash(tail -100 T:\Temp\claude\A--Work-ultimate-hierophant\tasks\bf5fd46.output)                                                                                                 
  ⎿  Error: Exit code 1                                                                                                                                                           
     tail: cannot open 'T:TempclaudeA--Work-ultimate-hierophanttasksbf5fd46.output' for reading: No such file or directory   

If you use Bash, you should use Bash line separators, and something like /t/Temp probably. If you prefer Windows separators then fork to Windows shell.

shyney7 · 5 months ago

CC is a joke on windows and they dont seem to care. On the other hand they block oauth usage of opencode that doesnt suffer from this symptoms because the devs know how to design propper TUI's.

Florian-Thake · 5 months ago

+1 for please, fix the Claude Code Windows native experience.
I am using Command Prompt inside Windows Terminal and Claude Code is launching itself inside git-bash. These combinations don't workout well.
I would suggest to let Claude Code really run native on Windows. There are enough tools available to solve problems, if - yes, if - Claude Code could use them without running in errors. If it really needs the git-bash tools, it could launch them on demand (if they are available) like it tries now with cmd.exe, but fails to do so because it needs to double escape all the parameters.

Florian-Thake · 5 months ago

Claude itself would highly prefer a clean and real Windows native solution:

Honestly, yes — for my use case, running in cmd or PowerShell directly would likely be cleaner. Here's my reasoning: Why cmd/PowerShell might be better for Claude Code: 1. I have dedicated tools — I don't need bash's grep, find, cat, sed because I have Grep, Glob, Read, Edit tools that work natively 2. Fewer escaping layers — The $env issue we just hit, path backslash problems, quote nesting — all go away 3. Windows-native tools just work — PowerShell, .NET commands, Windows paths without translation 4. Git works fine in cmd — Git for Windows includes git.exe that runs natively When I'd still want bash: - Complex shell scripting with pipes, loops, conditionals - Running Linux-oriented build scripts - Tools that only exist in Unix ecosystem A hybrid approach could work well: - Default to cmd/PowerShell - Explicitly call bash -c '...' when Unix tools are genuinely needed
cmwalton · 5 months ago

Still happening on Windows 11 with Claude Code latest. CLAUDE_CODE_SHELL is set to "pwsh" in ~/.claude/settings.json under the env key. The env var shows up inside the session (echo $CLAUDE_CODE_SHELL returns "pwsh"), but the Bash tool still uses /usr/bin/bash (Git Bash). pwsh is installed and works fine when invoked explicitly.

Workaround: prefixing commands with pwsh -Command or pwsh -File -, but the Bash tool itself ignores the setting.

shyney7 · 5 months ago

Yet another Windows issue introduced: https://github.com/anthropics/claude-code/issues/24855

cruzlauroiii · 4 months ago

A fix is available as a Claude Code plugin: powershell-default

Install:

/plugin marketplace add cruzlauroiii/claude-code
/plugin install powershell-default@cruzlauroiii-plugins

Adds a native Pwsh tool (shows as Pwsh(...) in the UI). Commands use PowerShell syntax directly. When enabled, Bash tool is blocked. Works on any OS with PowerShell 7+.

PR: https://github.com/anthropics/claude-code/pull/35761