[DOCS] Add windows specific environment variable usage for hooks

Resolved 💬 3 comments Opened Feb 10, 2026 by SanderPs Closed Mar 11, 2026

Documentation Type

Unclear/confusing documentation

Documentation Location

https://code.claude.com/docs/en/hooks

Section/Topic

Reference scripts by path

Current Documentation

Use environment variables to reference hook scripts relative to the project or plugin root, regardless of the working directory when the hook runs:

- $CLAUDE_PROJECT_DIR: the project root. Wrap in quotes to handle paths with spaces.
- ${CLAUDE_PLUGIN_ROOT}: the plugin’s root directory, for scripts bundled with a [plugin](https://code.claude.com/docs/en/plugins).

What's Wrong or Missing?

There is a Windows shell issue. Claude Code sets CLAUDE_PROJECT_DIR as an environment variable, but on Windows the shell is cmd.exe, which uses %VAR% syntax — not $VAR

Suggested Improvement

This should at least be mentioned. There seem to be more people having an issue with this.

Ideally one would like a solution which works both with bash and cmd

Impact

Medium - Makes feature difficult to understand

Additional Context

Error looks something like this:

SessionEnd hook [uv run "$CLAUDE_PROJECT_DIR"/.claude/hooks/session_logger.py] failed: error: Failed to spawn: `$CLAUDE_PROJECT_DIR/.claude/hooks/session_logger.py`
  Caused by: The system cannot find the path specified. (os error 3)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗