Skip to content

[Windows] "Open in → PowerShell" fails with CommandNotFoundException (open-path runs the directory as a command) #40277

Description

@zk-boop

Description

Clicking "Open in → PowerShell" in the session header dropdown of OpenCode Desktop on Windows fails with an error toast:

Error invoking remote method 'open-path': Error: Command failed:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
D:\path\to\project
D:\path\to\project : The term 'D:\path\to\project' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. (CommandNotFoundException)

Root cause (from reading the packaged code): the renderer's Windows "Open in" menu passes openWith: "powershell", which calls platform.openPath(directory, "powershell"). The main-process handler then runs:

execFile("powershell", [path]) // = powershell.exe D:\path\to\project

PowerShell treats the positional argument as a script/command to execute, not a directory to open, so it fails with CommandNotFoundException. This affects any shell (verified with both Windows PowerShell 5.1 and PowerShell 7 / pwsh), so it is broken by design of the open-path handler, not environment-specific.

Expected: "Open in → PowerShell" should open a PowerShell session in the project directory, e.g. spawn powershell/pwsh with -NoExit -WorkingDirectory , or reuse the node-pty shell spawn the app already uses for its built-in terminal panel (which works correctly).

Plugins

None

OpenCode version

OpenCode Desktop 1.18.11 (bundled opencode sidecar)

Steps to reproduce

  1. Open OpenCode Desktop on Windows and open any project folder
  2. In the session header, click the "Open in" dropdown
  3. Select "PowerShell"
  4. An error toast appears: CommandNotFoundException - the project directory is executed as a command

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

OpenCode Desktop built-in terminal panel / Windows Terminal

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions