Skip to content

fix: document -ExecutionPolicy Bypass and ~ path for Windows install#36

Merged
daniel3303 merged 1 commit into
mainfrom
fix/windows-execution-policy-bypass
Apr 23, 2026
Merged

fix: document -ExecutionPolicy Bypass and ~ path for Windows install#36
daniel3303 merged 1 commit into
mainfrom
fix/windows-execution-policy-bypass

Conversation

@daniel3303
Copy link
Copy Markdown
Owner

Closes #25.

Summary

On a default Windows install, PowerShell's ExecutionPolicy is Restricted — and on corporate machines Group Policy frequently enforces AllSigned. The previous "powershell -NoProfile -File ..." command is refused with UnauthorizedAccess in both cases. Because Claude Code invokes the status line with stderr muted, the refusal is silent: no status line renders, no error surfaces, no hint points the user at the execution policy.

The reporter in #25 diagnosed this cleanly and provided a tested fix. Adopt it in INSTALL.md.

Code changes

  • INSTALL.md — Windows section
    • Add -ExecutionPolicy Bypass to the command. This is process-scoped — the machine's policy is untouched, but the unsigned statusline.ps1 is allowed to run in this one invocation.
    • Lead with pwsh (PowerShell 7+, the actively developed cross-platform shell). Provide a documented fallback to Windows PowerShell 5.1 for users who have not installed PS7.
    • Replace %USERPROFILE%\.claude\statusline\statusline.ps1 with ~/.claude/statusline/statusline.ps1. Claude Code v2.1.47+ expands ~ on Windows, and the release notes explicitly recommend dropping %USERPROFILE%.
    • Collapse the separate CMD/PowerShell and Git Bash / WSL blocks — ~ works in both, so the split is no longer needed. Keep the legacy %USERPROFILE% / $USERPROFILE variants in a note for users still on older Claude Code builds.
    • Add a troubleshooting note explaining why -ExecutionPolicy Bypass is required, so the next user who hits a locked-down machine understands what the flag does and that it is safe.

How to test

  1. On a Windows 10/11 box with a default Restricted (or corporate AllSigned) ExecutionPolicy, follow the updated INSTALL.md Windows section.
  2. Restart Claude Code.
  3. Confirm the status line renders.
  4. (Optional sanity check) run Get-ExecutionPolicy -List afterwards — the machine's policy should be unchanged; the bypass only applied to the status-line's pwsh/powershell process.

@daniel3303 daniel3303 merged commit 93b0cc0 into main Apr 23, 2026
@daniel3303 daniel3303 deleted the fix/windows-execution-policy-bypass branch April 23, 2026 16:40
Closes #25.

On a default Windows install the PowerShell ExecutionPolicy is
Restricted (or AllSigned on corporate machines via Group Policy).
Claude Code invokes the status-line command with stderr muted, so
when powershell.exe refuses to run the unsigned statusline.ps1 the
user sees nothing — no status line, no error — and has no hint
where to look.

Fix the documented Windows command:

* Add -ExecutionPolicy Bypass (process-scoped, does not touch the
  machine policy) so the script runs under default Restricted or
  AllSigned policies.
* Prefer pwsh (PowerShell 7+) with a documented fallback to the
  built-in powershell 5.1.
* Replace %USERPROFILE%\.claude\... with the Unix-style
  ~/.claude/... path that Claude Code v2.1.47+ now expands on
  Windows. Keep the legacy %USERPROFILE% / $USERPROFILE variants
  in a note for users still on older Claude Code builds.
* Collapse the separate CMD/PowerShell and Git Bash / WSL blocks
  into a single command now that ~ works in both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

statusline.ps1 fails silently on Windows when PowerShell ExecutionPolicy blocks unsigned scripts

1 participant