When Claude Code breaks silently on Windows
No error, just a wrong result. Each page takes one symptom you meet when running Claude Code or scripts unattended on Windows: a 30-second check, the cause and the fix. Every one happened on the author's machine.
Claude Code hooks
- H01
A Claude Code PreToolUse hook lets the write through when it times out - H02
A PowerShell hook called with -Command does not block Claude Code - H03
No Claude Code hook runs at all (disableAllHooks is still set)
PowerShell, Python, cmd
- T01
PowerShell returns exit code 1 when the script exited with 2 - T02
The second value passed with -File disappears without an error - T03
With -File, a,b stays one string instead of an array - T04
Non-ASCII text piped to claude -p, python or git arrives as ? - T05
Output from python or claude turns into mojibake in a variable - T06
Python works when run by hand but crashes under Task Scheduler or redirection - T07
PYTHONIOENCODING is set, but python -I ignores it - T08
A .ps1 with non-ASCII text fails to parse or prints mojibake - T09
A .cmd / .bat file runs its comment text as commands - T10
$variables in a powershell -Command one-liner vanish before it runs - T11
Get-ChildItem -Include is ignored and every file comes back - T12
Markdown backticks inside "..." turn into newlines and tabs - T13
A log that is being written shows 0 bytes - T14
claude -p --allowedTools swallows the prompt after it
cc-win-kit bundles the parts that avoid these traps from the start: a write guard (with onFailure: block), an unattended runner, a doctor that scans your files and hook settings, CLAUDE.md templates and the full test suite.