claude-code - 💡(How to fix) Fix [BUG] PowerShell tool launches powershell.exe (5.1) instead of pwsh.exe (7) when PS7 is installed via Microsoft Store (MSIX) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55041Fetched 2026-05-01 05:47:47
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4closed ×1commented ×1

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Workaround: none known from the user side — the PowerShell tool's interpreter selection isn't user-configurable as far as I can tell. Falling back to the Bash tool when PS7-specific syntax is needed.

Code Example

> where pwsh.exe
   C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe
   > pwsh -NoProfile -Command "$PSVersionTable.PSVersion.ToString()"
   7.6.1

---

Name                           Value
----                           -----
PSVersion                      5.1.26100.8115
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.8115
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code's PowerShell tool launches powershell.exe (Windows PowerShell 5.1, Desktop edition) even when PowerShell 7 is installed and on PATH — specifically when PS7 was installed via the Microsoft Store (MSIX), where pwsh.exe on PATH is the WindowsApps execution alias rather than a normal .exe.

This appears related to but not covered by the fix for #54335.

What Should Happen?

The PowerShell tool should launch pwsh.exe (PowerShell 7) when it is available on PATH, regardless of whether the install is MSI/winget or MSIX/Store.

Steps to Reproduce

  1. On Windows 11, install PowerShell 7 from the Microsoft Store (this is the MSIX install). Confirm pwsh.exe resolves on PATH:
    > where pwsh.exe
    C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe
    > pwsh -NoProfile -Command "$PSVersionTable.PSVersion.ToString()"
    7.6.1
    The WindowsApps\pwsh.exe entry is an MSIX execution alias that resolves to C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.1.0_x64__8wekyb3d8bbwe\pwsh.exe.
  2. Open Claude Code in any directory.
  3. Ask Claude to run $PSVersionTable via the PowerShell tool.
  4. Observe that the output reports PowerShell 5.1 / Desktop, not 7.x / Core.

Error Messages/Logs

Output of $PSVersionTable from the PowerShell tool:

Name                           Value
----                           -----
PSVersion                      5.1.26100.8115
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.8115
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Claude Code Version

2.1.123 (Claude Code)

Operating System

Windows 11 Pro 10.0.26200

Terminal/Shell

Windows Terminal (bug is not terminal-dependent — the PowerShell tool spawns its own interpreter subprocess)

Is this a regression?

I don't know — the previous fix (#54335) targeted the VSCode extension; I have not verified whether the bare CLI ever resolved pwsh.exe correctly on a Microsoft Store install.

Additional Information

Why this looks distinct from #54335:

  • #54335 was titled "Claude Code for VSCode uses powershell.exe instead of pwsh.exe" and was closed as completed on 2026-04-28.
  • This repro is the standalone CLI (claude 2.1.123) in a regular terminal — not the VSCode extension — and the version was released after that close.
  • The install pattern is the MSIX / Microsoft Store variant. On PATH, pwsh.exe is an execution alias under %LOCALAPPDATA%\Microsoft\WindowsApps, not a normal .exe. A resolver that uses a normal Get-Command-style PATH lookup picks it up; one that filters out WindowsApps aliases or stat-checks the underlying file would miss it. So the MSIX install case appears not to be covered by whatever fix landed for #54335, hence filing fresh rather than asking for a reopen.

Workaround: none known from the user side — the PowerShell tool's interpreter selection isn't user-configurable as far as I can tell. Falling back to the Bash tool when PS7-specific syntax is needed.

extent analysis

TL;DR

The PowerShell tool in Claude Code may need to be updated to correctly resolve the pwsh.exe executable when installed via the Microsoft Store (MSIX), to launch PowerShell 7 instead of PowerShell 5.1.

Guidance

  • Verify that the pwsh.exe executable is correctly resolved on the PATH by running where pwsh.exe in the terminal.
  • Check if the PowerShell tool in Claude Code uses a Get-Command-style PATH lookup to resolve the pwsh.exe executable, which may not work with MSIX installation aliases.
  • Consider modifying the PowerShell tool to handle MSIX installation aliases correctly, or provide a user-configurable option to specify the PowerShell executable to use.
  • As a temporary workaround, use the Bash tool for PS7-specific syntax, as suggested in the issue report.

Example

No code snippet is provided, as the issue is related to the internal implementation of the PowerShell tool in Claude Code.

Notes

The issue may be specific to the MSIX installation method and the WindowsApps execution alias, which may not be covered by the previous fix for #54335.

Recommendation

Apply a workaround, such as using the Bash tool for PS7-specific syntax, until the PowerShell tool is updated to correctly handle MSIX installation aliases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] PowerShell tool launches powershell.exe (5.1) instead of pwsh.exe (7) when PS7 is installed via Microsoft Store (MSIX) [1 comments, 2 participants]