[BUG] Windows paths with backslashes in settings.json statusLine.command are double-unescaped

Open 💬 0 comments Opened Jun 14, 2026 by MattiJarvinen

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 configuring statusLine.command in %USERPROFILE%/.claude/settings.json on Windows using backslash-escaped paths (standard JSON encoding), Claude Code double-unescapes the path. JSON correctly decodes \\ to \, but Claude Code then strips the backslashes a second time, producing an invalid path.

/statusline command also writes the path using \\ leading to the same non working state.

For example, the JSON value:
"pwsh -NoProfile -File C:\\Users\\user\\.claude\\statusline.ps1"
is parsed by Claude Code as:
pwsh -NoProfile -File C:Usersuser.claudestatusline.ps1
All backslashes are removed, the command fails silently, and the statusline never renders.

What Should Happen?

The command string should be passed to the shell with backslashes intact (C:\Users\user\.claude\statusline.ps1), executing the script and rendering the configured statusline at the bottom of the TUI.

Error Messages/Logs

The argument 'C:Usersuser.claudestatusline.ps1' is not recognized as the name of a script file.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (Observed when running the mangled command manually to diagnose the issue.)

Steps to Reproduce

  1. Use /statusline command on windows 11 and pwsh

OR

  1. On Windows, create C:\Users\user\.claude\statusline.ps1 with any content that writes to stdout (e.g. Write-Output "hello")
  2. Add the following to C:\Users\user\.claude\settings.json:
  {   
      "statusLine": {
        "type": "command",
        "command": "pwsh -NoProfile -File C:\\Users\\user\\.claude\\statusline.ps1"
      }
  }
  1. Launch claude in any project directory
  2. Observe: no statusline is rendered
  3. To confirm the cause, run the resulting command manually — backslashes will be missing from the path

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.177

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Workaround: Use forward slashes in the path. PowerShell accepts them and they require no escaping:
"command": "pwsh -NoProfile -File C:/Users/user/.claude/statusline.ps1"

View original on GitHub ↗