statusLine command fails silently on Windows when path contains spaces (no Git Bash, quotes stripped by `powershell -Command`)
Description
On Windows, when Git Bash is not installed, Claude Code runs the statusLine.command string through powershell -Command <string>. If the command contains a quoted executable path with spaces (e.g. "C:/Program Files/nodejs/node.exe" "...\launcher.cjs" render), the outer quotes are stripped during argument passing, and PowerShell tries to run C:/Program as a bare command name, which fails.
The script then exits non-zero / produces no output, so per the documented behavior ("Scripts that exit with non-zero codes or produce no output cause the status line to go blank") the status line silently stays blank — with no error surfaced to the user in the normal UI.
Steps to reproduce
- On Windows, without Git Bash installed.
- Set in
~/.claude/settings.json:
``json``
{
"statusLine": {
"type": "command",
"command": "\"C:/Program Files/nodejs/node.exe\" \"C:/Users/<user>/.claude/some-script.cjs\" render"
}
}
- Restart Claude Code.
Expected behavior
The status line renders using the configured command.
Actual behavior
Status line stays blank. No error is shown in the normal UI (only visible via claude --debug, where the underlying error is The term 'C:/Program' is not recognized as the name of a cmdlet, function, script file, or operable program...).
Reproducible directly:
$cmdStr = '"C:/Program Files/nodejs/node.exe" "C:/Users/<user>/.claude/some-script.cjs" render'
powershell.exe -NoProfile -Command $cmdStr
# -> CommandNotFoundException: C:/Program
Workaround
Wrap the command in a .ps1 file and invoke it with -File instead of embedding quoted paths directly in the command string:
# run.ps1
& "C:/Program Files/nodejs/node.exe" "C:/Users/<user>/.claude/some-script.cjs" render
{
"statusLine": {
"type": "command",
"command": "powershell -NoProfile -File C:/Users/<user>/.claude/run.ps1"
}
}
This works because -File takes a single path argument, avoiding the nested-quote stripping that happens with -Command.
Suggested fix
Either invoke the configured command string via cmd /c (which preserves quoted-first-token semantics) instead of powershell -Command, or document this Windows-without-Git-Bash quoting pitfall explicitly in the statusline docs' Windows configuration / Troubleshooting section, alongside the existing Git Bash backslash-escaping note.
Environment
- OS: Windows 11
- Claude Code version: 2.1.237
- Git Bash: not installed (statusLine commands run via PowerShell)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗