PowerShell tool fails with exit code 1 on Windows when pwsh installed via winget

Status Fixed / completed
Reported on v2.1.126
Maintainer reply None cached
Activity 4 comments · opened May 3, 2026 · closed May 20, 2026

Description

The PowerShell tool (pwsh) fails with Exit code 1 on Windows, even when PowerShell 7 is correctly installed via winget. The Bash tool calling pwsh -Command "..." works fine, so the issue is specific to how Claude Code's PowerShell tool invokes pwsh.

Steps to reproduce

  1. Install PowerShell 7 via winget: winget install Microsoft.PowerShell
  2. Open Claude Code on Windows
  3. Ask Claude to run any PowerShell command using the PowerShell tool

Expected behavior

PowerShell tool executes the command and returns output.

Actual behavior

Exit code 1

No output, no error message.

Environment

  • OS: Windows 11 Enterprise 10.0.26100
  • PowerShell version: 7.6.1.0 (installed via winget install Microsoft.PowerShell)
  • Claude Code version 2.1.126
  • pwsh location: C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe
  • Bash tool calling pwsh -Command "Write-Output test" works correctly

Workaround

Using the Bash tool with pwsh -Command "..." works as a workaround.

View original on GitHub ↗

4 Comments

github-actions[bot] · 3 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/55481
  2. https://github.com/anthropics/claude-code/issues/55190
  3. https://github.com/anthropics/claude-code/issues/55727

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

cveld · 3 months ago

@ant-kurt with vscode extension version 2.1.145 I still has the issue. Can you reopen this issue? I don't think #57279 is related.

cveld · 3 months ago

Cool! In 2.1.152 the issue seems to be fixed!

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.