Skip to content

[BUG] Claude Code repeatedly uses Bash syntax (extglob) on Windows PowerShell and fails to adapt #28670

@pm0code

Description

@pm0code

Preflight Checklist

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

What's Wrong?

When running Claude Code on a Windows machine, the agent attempts to execute Linux/Bash specific shell features (specifically extglob) inside PowerShell. When PowerShell returns a standard "term is not recognized" error, the agent fails to understand the OS context, does not self-correct to use PowerShell-native commands, and gets stuck repeatedly trying to execute the same incompatible command.

What Should Happen?

Claude Code should recognize the Windows/PowerShell environment and translate Bash-centric file operations into their PowerShell equivalents (e.g., using Get-ChildItem, Where-Object, or standard regex). Upon receiving a PowerShell error, it should immediately recognize the shell mismatch and self-correct.

Error Messages/Logs

`extglob.CommandLine: The term 'extglob.CommandLine' is not recognized as a name of a cmdlet, function, script file, or executable program.`

Steps to Reproduce

  1. Run Claude Code in a Windows PowerShell environment.
  2. [What prompt did you use? e.g., "Find all files matching this pattern..." or "Delete all files except..."]
  3. Claude Code attempts to run a bash command using extglob.
  4. PowerShell throws the cmdlet recognition error.
  5. Claude reads the error but fails to pivot to Windows commands, often repeating the mistake.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.56

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions