[BUG] ! prefix ignores configured primary shell on Windows, always routes to bash

Resolved 💬 2 comments Opened Jun 22, 2026 by vaflya32407 Closed Jun 26, 2026

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?

On Windows, the ! command prefix always dispatches to /usr/bin/bash (Git Bash), ignoring the configured primary shell. When PowerShell is set as the primary shell, .cmd and .bat files invoked via ! fail with command not found.

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell (configured): PowerShell (primary)

Steps to Reproduce

  1. Configure PowerShell as primary shell on Windows
  2. Type ! some-script.cmd in the Claude Code prompt
  3. Observe: /usr/bin/bash: line 1: some-script: command not found

Expected Behavior

! dispatches through the configured primary shell (PowerShell), so .cmd and .bat files resolve correctly.

Actual Behavior

! hardcodes /usr/bin/bash regardless of primary shell setting. Windows-native scripts are unreachable via ! on any system where Git Bash is installed alongside PowerShell.

Impact

No user-side workaround exists — the only fix is to have the AI invoke the script via the PowerShell tool, which defeats the purpose of !.

What Should Happen?

The ! prefix should dispatch through the configured primary shell (PowerShell on Windows), so .cmd and .bat files are found and executed correctly.

Error Messages/Logs

!

Steps to Reproduce

Steps to Reproduce — replace the placeholder with:

  1. Install Git Bash and PowerShell on Windows 11
  2. Open Claude Code — primary shell is configured as PowerShell
  3. Type: ! LLM_test-close.cmd (or any .cmd file in PATH)
  4. Observe: /usr/bin/bash: line 1: LLM_test-close: command not found

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.183 (Claude Code)

Platform

Other

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Workaround: invoke the script via the PowerShell tool directly. The ! shortcut is effectively broken for Windows-native scripts on any Windows system with Git Bash installed.

View original on GitHub ↗

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