[BUG] Status Line Command Cannot Execute External Scripts on Windows
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?
Status Line Command Cannot Execute External Scripts on Windows
Environment
- OS: Windows 11 Enterprise 10.0.26200
- Shell: bash (Git Bash)
- Terminal: xterm-256color
- Claude Code Model: claude-sonnet-4-5-20250929
Issue Description
Status line commands with inline text (e.g., echo 'text') work correctly, but any attempt to execute an external script file fails silently. The script is never invoked, regardless of path format or invocation method.
Expected Behavior
The status line should execute external script files and display their output, similar to how inline commands work.
Actual Behavior
- ✅ Simple inline commands work:
echo 'TEST STATUS LINE' - ❌ External scripts never execute (no output, no errors, no logs)
Configuration That Works
{
"statusLine": {
"type": "command",
"command": "echo 'TEST STATUS LINE - If you see this, status lines work!'"
}
}
Configuration That Fails
All of the following configurations fail silently (script never executes):
// Attempt 1: Original format
{"statusLine": {"type": "command", "command": "bash /c/Users/egabrilovich/.claude/statusline-command.sh"}}
// Attempt 2: Windows path format
{"statusLine": {"type": "command", "command": "bash C:/Users/egabrilovich/.claude/statusline-command.sh"}}
// Attempt 3: Direct execution (script has shebang)
{"statusLine": {"type": "command", "command": "/c/Users/egabrilovich/.claude/statusline-command.sh"}}
// Attempt 4: HOME variable
{"statusLine": {"type": "command", "command": "bash \"$HOME/.claude/statusline-command.sh\""}}
// Attempt 5: Tilde expansion
{"statusLine": {"type": "command", "command": "bash ~/.claude/statusline-command.sh"}}
// Attempt 6: Without bash prefix
{"statusLine": {"type": "command", "command": "~/.claude/statusline-command.sh"}}
// Attempt 7: Quoted absolute path
{"statusLine": {"type": "command", "command": "\"/c/Users/egabrilovich/.claude/statusline-command.sh\""}}
// Attempt 8: Using sh
{"statusLine": {"type": "command", "command": "sh /c/Users/egabrilovich/.claude/statusline-command.sh"}}
// Attempt 9: Windows path without bash
{"statusLine": {"type": "command", "command": "C:/Users/egabrilovich/.claude/statusline-command.sh"}}
// Attempt 10: cmd.exe wrapper
{"statusLine": {"type": "command", "command": "cmd /c bash /c/Users/egabrilovich/.claude/statusline-debug.sh"}}
// Attempt 11: .bat file wrapper
{"statusLine": {"type": "command", "command": "C:/Users/egabrilovich/.claude/statusline.bat"}}
Test Script
The script is executable and works correctly when invoked manually:
$ ls -la /c/Users/egabrilovich/.claude/statusline-command.sh
-rwxr-xr-x 1 REDMOND+egabrilovich 4096 770 Feb 18 19:05 /c/Users/egabrilovich/.claude/statusline-command.sh*
$ echo '{"model":{"display_name":"Sonnet 4.5"},"context_window":{"used_percentage":12}}' | bash /c/Users/egabrilovich/.claude/statusline-command.sh
Sonnet 4.5 [0;32m[##..................][0m 12% used
Script Content
#!/usr/bin/env bash
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name // "Claude"')
used=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
BAR_WIDTH=20
if [ -n "$used" ]; then
used_int=$(printf "%.0f" "$used")
filled=$(( used_int * BAR_WIDTH / 100 ))
empty=$(( BAR_WIDTH - filled ))
bar=""
for i in $(seq 1 $filled); do bar="${bar}#"; done
for i in $(seq 1 $empty); do bar="${bar}."; done
if [ "$used_int" -ge 90 ]; then
color="\033[0;31m" # red
elif [ "$used_int" -ge 70 ]; then
color="\033[0;33m" # yellow
else
color="\033[0;32m" # green
fi
reset="\033[0m"
printf "%s ${color}[%s]${reset} %d%% used" "$model" "$bar" "$used_int"
else
printf "%s [....................] " "$model"
fi
Verification
Created a debug script that logs when called - log file is never created, confirming the script is never executed:
$ cat /c/Users/egabrilovich/.claude/statusline-debug.log
cat: /c/Users/egabrilovich/.claude/statusline-debug.log: No such file or directory
Expected Resolution
Status line should support executing external scripts on Windows, similar to how other shell commands are executed. Either:
- Fix script execution in status line commands on Windows
- Document the limitation and provide workaround guidance
- Provide better error reporting when commands fail
What Should Happen?
The status line should execute external script files and display their output, similar to how inline commands work.
Error Messages/Logs
there is no error - just the status line is not showing despite numerous attempts
Steps to Reproduce
see above
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.47
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 ↗