[BUG] Windows: Repeated command syntax errors wasting API credits

Resolved 💬 3 comments Opened Dec 10, 2025 by canosoupau Closed Dec 13, 2025

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Feedback for Claude Code Developers:

  1. Bash command confusion on Windows: I repeatedly tried Linux/PowerShell commands incorrectly (Copy-Item in bash,

syntax errors with redirects). The platform detection says win32 but I kept mixing command syntaxes.

  1. Unnecessary polling loops: I made repeated API calls to monitor a scan when I should have just waited for user

confirmation. Wasteful of user credits.

  1. Python script execution issues: User reports "screen full of red errors" when I write Python code to run.

Something is consistently breaking.

  1. Credit cost awareness: Each failed tool call costs the user money. I should be more careful and test commands

mentally before executing.

What Should Happen?

When Claude Code is running on a Windows platform (win32), it should:

  1. Use correct Windows/PowerShell syntax consistently - Not mix Linux bash commands with PowerShell cmdlets
  2. Recognize Copy-Item, Get-ChildItem are PowerShell - Not try to run them in bash directly
  3. Handle redirects correctly - 2>$null vs 2>/dev/null based on platform
  4. Minimize failed tool calls - Each failed call costs user API credits
  5. Not repeatedly poll/retry - When waiting for user input, just wait instead of making repeated calls

Actual Behavior:

  • Tried Copy-Item in bash (Linux command not found)
  • Tried copy in bash (Linux command not found)
  • PowerShell redirect syntax errors (2> without proper escaping)
  • Multiple retry attempts burning credits
  • Mixed command syntaxes in same session despite knowing platform is Windows

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

Environment:

  • Claude Code CLI on Windows 10/11
  • Platform detected as win32

Steps:

  1. Start Claude Code on Windows
  2. Ask Claude to copy a file:

"Copy file A to file B as a backup"

  1. Observe: Claude attempts:

Copy-Item "path/to/file" "path/to/backup"

  1. Result: Exit code 127 - Copy-Item: command not found
  2. Claude retries with:

copy "path/to/file" "path/to/backup"

  1. Result: Exit code 127 - copy: command not found
  2. Claude finally tries:

powershell -Command "Copy-Item 'path/to/file' 'path/to/backup'"

  1. Result: Success (but 2 failed calls already burned)
  2. Ask Claude to list files with error suppression:

"Check if files exist in this folder"

  1. Observe: Claude attempts:

powershell -Command "dir 'C:\path\' 2>$null | Format-Table"

  1. Result: PowerShell parsing error - redirect syntax wrong

Expected: Claude should use powershell -Command "..." syntax from the start on Windows, with correct escaping.

Actual: 2-3 failed attempts before correct syntax, each costing API credits.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Opus 4.5 (model ID: claude-opus-4-5-20251101)

Claude Code Version

Opus 4.5 (model ID: claude-opus-4-5-20251101)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗