Repository navigation
Description
Description
Description
On Windows, copying a selection in the OpenCode TUI fails with:
Executable not found in $PATH: "powershell.exe"
I installed OpenCode via Bun:
bun add -g opencode-ai
PowerShell 7 (pwsh.exe) is installed and is my main shell, but the legacy Windows PowerShell path was removed from PATH. The TUI appears to invoke powershell.exe (likely for Set-Clipboard), so PATH resolution fails even though the file exists on disk.
Why it happens
Many Windows clipboard implementations in CLIs still rely on Windows PowerShell 5.1:
powershell.exe -Command Set-Clipboard ...
If this directory is missing from PATH:
C:\Windows\System32\WindowsPowerShell\v1.0\
then powershell.exe can’t be found, causing the error.
Environment
- OS: Windows
- Shell: PowerShell 7 (
pwsh) - Install:
bun add -g opencode-ai - Issue: TUI selection copy/clipboard
Checks (commands that worked)
File exists:
Test-Path "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"PATH contains the directory:
$env:Path -split ';' | Select-String -SimpleMatch "WindowsPowerShell\v1.0"Verify resolution (important: where is an alias in PowerShell, so use where.exe):
where.exe powershellVerify Windows PowerShell runs:
powershell -NoProfile -Command '$PSVersionTable.PSVersion'Expected output shows PowerShell 5.1.x.
Fix
Add back to System PATH:
C:\Windows\System32\WindowsPowerShell\v1.0\
Restart terminal + restart the TUI.
Suggested improvement
On Windows, fallback order could be:
pwsh.exepowershell.execlip.exe
This avoids clipboard failures on machines that only expose PowerShell 7.
Plugins
No response
OpenCode version
1.1.36
Steps to reproduce
Steps to Reproduce
-
Use Windows with PowerShell 7 as primary shell
Install PowerShell 7 and remove the legacy Windows PowerShell path from PATH:C:\Windows\System32\WindowsPowerShell\v1.0\ -
Install OpenCode using Bun
bun add -g opencode-ai -
Open a new PowerShell terminal
-
Run OpenCode
opencode -
Inside the TUI, select text and trigger copy
-
Observe error
Executable not found in $PATH: "powershell.exe"
Root condition required
The issue occurs when:
powershell.exeexists on disk- but its directory is missing from PATH
- and the TUI attempts to use it for clipboard operations
Screenshot and/or share link
Operating System
Windows 11
Terminal
Windows Terminal
Activity
github-actions commentedon Jan 27, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.