[BUG] Windows Shell Compatibility: PowerShell variables (extglob.*) causing command failure
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?
When Claude Code attempts to execute PowerShell commands that involve variable expansion or filtering (e.g., using Where-Object with $_), the Bash-based tool on Windows incorrectly pre-processes the string. This results in the shell attempting to interpret PowerShell properties as standalone commands, leading to the error:
extglob.Line: The term 'extglob.Line' is not recognized as a name of a cmdlet, function, script file, or executable program.
What Should Happen?
Claude Code should properly escape PowerShell-specific characters (like $) or use a direct execution method that bypasses Bash variable expansion when operating on Windows.
Error Messages/Logs
powershell.exe -Command "Get-Service | Where-Object {$_.Status -ne 'Running'}"
Steps to Reproduce
Run Claude Code on a Windows system using a standard terminal (PowerShell or Windows Terminal).
Ask Claude to perform a task that requires filtering output via PowerShell, such as:
powershell.exe -Command "Get-Service | Where-Object {$_.Status -ne 'Running'}"
Observe the error as the AI repeatedly attempts to execute the command without proper escaping.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
latest as of today
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗