[BUG] Hooks don't work on windows

Resolved 💬 3 comments Opened Jul 22, 2025 by Reekin Closed Jul 22, 2025

platform: windows 10
claude code version: v1.0.57

I've created a repeated issue before, but it was closed without providing a feasible solution and I'm unable to reopen it, so I have to create another issue.

In wsl settings, the command was ~/bin/script.sh, which works well.
On windows, I changed it into C:\Users\UserName\bin\script.sh and put the sh file to the path, and got error: failed with non-blocking status code 127: bash: C:UsersUserNamebinscript.sh: No such file or directory.

I've tried so many ways of writing:

C:\\Users\\UserName\\bin\\script.sh:
PostToolUse:Edit [C:\Users\UserName\bin\script.sh] failed with non-blocking status code 127: /usr/bin/bash: line 1: C:UsersUserNamebinscript.sh: command not found

bash C:\\Users\\UserName\\bin\\script.sh:
PostToolUse:Edit [bash C:\Users\UserName\bin\script.sh] failed with non-blocking status code 127: bash: C:UsersUserNamebinscript.sh: No such file or directory

\\mnt\\c\\Users\\UserName\\bin\\script.sh:
PostToolUse:Edit [\mnt\c\Users\UserName\bin\script.sh] failed with non-blocking status code 127: /usr/bin/bash: line 1: mntcUsersUserNamebinscript.sh: command not found

~\\bin\\script.sh:
PostToolUse:Edit [~\bin\script.sh] failed with non-blocking status code 127: /usr/bin/bash: line 1: ~script.sh: command not found

\\c\\Users\\UserName\\bin\\script.sh:
PostToolUse:Edit [\c\Users\UserName\bin\script.sh] failed with non-blocking status code 127: /usr/bin/bash: line 1: cUsersUserNamebinscript.sh: command not found

/mnt/c/Users/UserName/bin/script.sh,
/c/Users/UserName/bin/script.sh,
C:/Users/UserName/bin/script.sh
C:\\\\Users\\\\UserName\\\\bin\\\\script.sh :
got nothing, and in verbose mode, it says the command completed successfully, but in fact it was not executed.

Could you please provide a path configuration example that has been tested and confirmed to work successfully on Windows?
Or rather, I hope to see a more comprehensive explanation on how to migrate hooks that currently work correctly in wsl to Windows, including how paths should be specified, whether sh scripts should still be used, and how packages like jq used in wsl scripts should be prepared, etc.

View original on GitHub ↗

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