Skip to content

fix(desktop): open PowerShell 7 from Open in PowerShell on Windows - #64873

Merged
neriousy merged 1 commit into
devfrom
open-pwsh
Nov 19, 2026
Merged

neriousy merged 1 commit into
devfrom
open-pwsh

Conversation

@neriousy

Copy link
Copy Markdown
Member

Issue for this PR

Closes #62087

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Windows, Open in → PowerShell always launched Windows PowerShell 5.1, even when PowerShell 7 is installed.

The renderer resolves the entry's openWith (powershell) through resolveAppPath, which runs where powershell and always finds powershell.exe. Now, for the PowerShell entry, resolveAppPath tries pwsh first and falls back to powershell when where pwsh finds nothing. That matches what Windows Terminal does.

openPath in main only sent powershell.exe through the cmd /c start … -NoExit path, which opens a console window in the project folder. The check now matches pwsh(.exe) too. Without that, pwsh.exe would have gone through execFile(application, [target]), the same bug #55710 fixed for Windows PowerShell.

The menu entry, its label and the stored preference stay the same. No flag: this is a bug fix.

How did you verify your code works?

On Windows 11 with PowerShell 7 installed:

  • Ran resolveAppPath under Bun. resolveAppPath("powershell") returned C:\Program Files\PowerShell\7\pwsh.exe. With the PowerShell 7 and WindowsApps folders taken off PATH, it returned C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.
  • Ran the desktop app from this branch (bun run dev) and picked Open in PowerShell from a local session's path menu. A new console opened, and the process was "C:\Program Files\PowerShell\7\pwsh.exe" -NoExit.
  • bun typecheck in packages/desktop passes, and oxlint is clean on the touched files.

Screenshots / recordings

Not a visual change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct; I found nothing blocking. It only runs on Windows, so I reviewed it by reading the code. I couldn't run it here (Linux runner).

  • pwsh is only preferred when the app name is exactly powershell, and when where pwsh finds nothing the lookup falls back to powershell as before.
  • The widened check in openPath keeps pwsh.exe on the cmd /c start … -NoExit path, so it doesn't fall back into execFile(application, [target]) (the problem #55710 fixed for Windows PowerShell).
  • tsc -b in packages/desktop passes, and the desktop file and platform tests pass.

Public API: unchanged. The menu entry id, its label and the stored preference are the same.

@neriousy
neriousy merged commit 09cc0c7 into dev Nov 19, 2026
11 checks passed
@neriousy
neriousy deleted the open-pwsh branch November 19, 2026 13:43
joe-ieta pushed a commit to joe-ieta/OpenCode.My that referenced this pull request Nov 19, 2026
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
1 task
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.

[Windows] Desktop “Open in → PowerShell” launches PowerShell 5 instead of PowerShell 7

1 participant