ai-coding-minesIndexGitHub

`%USERPROFILE%` in a hook `command` is not expanded

Claude Code and agents

Symptom

Registered a hook; at session start there is a quiet startup hook error. The hook never runs.

Cause

The hook command string doesn't go through shell environment-variable expansion. %USERPROFILE%\... is used as a literal path.

Fix

Bake in the actual full path literal at install time.

For the same reason, use absolute paths rather than env vars when registering scheduled tasks (schtasks). If the path contains non-ASCII characters, solve the encoding problem first.

Why this bites non-ASCII users

On Windows the user profile folder is named after the account, and on a Korean-locale machine that is frequently a Korean name. So "just hardcode the absolute path" hands you a path with Hangul in it, and that path now has to survive every boundary from chapter 01 (the hook config file, the shell that runs it, the script it launches). English-named accounts never hit the second problem.