windows-bash-backslash-halvinglisted
Install: claude install-skill ychampion/ystack
# Windows Bash-tool backslash halving
## Problem
On Windows, command text sent through Claude Code's **Bash tool** (Git Bash) has `\\` collapsed to `\`
before the shell runs it, even inside single quotes, where POSIX forbids any escape processing. Values
that need exact doubled backslashes (named-pipe paths `\\.\pipe\x`, UNC paths `\\server\share`, regex
escapes) arrive corrupted, with no error.
## Trigger conditions
- The definitive probe: `printf '%s\n' 'a\\b'` in the Bash tool prints `a\b`. A real POSIX shell
prints `a\\b`.
- `net.createConnection({ path: "\.\pipe\x" })` (mangled from `\\.\pipe\x`) fails with ENOENT.
- The symptom can be indirect. Software with a local fallback quietly runs locally when its `pipe:`
endpoint env var is mangled, which masks the failure. Check the receiving process's environment, not
the command you wrote.
## Solution
1. **Use a PowerShell tool** for setting or testing exact-backslash values, if your harness has one.
`'pipe:\\.\pipe\x'` in a PowerShell-tool command arrives intact.
2. Or write the value to a **file** with the file-write or edit tool; no shell layer touches it. JSON
files still need normal JSON escaping (`"pipe:\\\\.\\pipe\\x"` decodes to `pipe:\\.\pipe\x`).
3. Or **double every backslash** in Bash-tool text: write `\\\\` to deliver `\\`.
4. Verify at the consumer, not the producer:
`node -e "console.log(JSON.stringify(process.env.MYVAR))"`.
## Verification
The `JSON.stringify` probe shows the exact chara