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
Workaround ✓ Mentioned in description ↑
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
- Install PowerShell 7 via winget:
winget install Microsoft.PowerShell - Open Claude Code on Windows
- 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.
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
@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.
Cool! In 2.1.152 the issue seems to be fixed!
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.