[BUG] Image paste (Alt+V) fails on Windows where PowerShell 5.1 is blocked by policy — clipboard helper spawns `powershell` (5.1); should prefer `pwsh.exe`
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
On Windows machines where execution of Windows PowerShell 5.1 (powershell.exe) is blocked by a security policy (an increasingly common hardening setup — PowerShell 7 pwsh.exe allowed, 5.1 disabled), pressing Alt+V with an image on the clipboard fails: nothing is pasted, or Claude Code reports there is no image, even though the image is verifiably present.
Root cause: the Windows clipboard-image helpers spawn PowerShell by the name powershell, e.g.:
powershell -NoProfile -NonInteractive -Sta -Command "Add-Type -AssemblyName System.Windows.Forms; if (-not [System.Windows.Forms.Clipboard]::ContainsImage()) { exit 1 }"
The name powershell resolves to Windows PowerShell 5.1. Where that binary is blocked, CreateProcess fails with Win32 error 1260 (ERROR_ACCESS_DISABLED_BY_POLICY), the helper never runs, and the failure surfaces as a silent no-op / "no image in clipboard".
Verified:
- Spawning
powershell.exe(5.1) fails with Win32 error 1260 under every flag combination on such a machine. - The identical helper command runs perfectly under
pwsh.exe(PowerShell 7) —System.Windows.Forms.Clipboardworks fine there. - In fact, Alt+V currently works on this machine only because the
powershellname resolution was redirected to PowerShell 7; with the default resolution (5.1) it always fails. - There is no user-facing setting to change which shell these helpers use, so this cannot be fixed from the user side — a patch is needed for it to work out of the box.
This may also explain some existing unresolved image-paste reports on Windows, e.g. #74674 (Alt+V fails while another CLI tool reads the same clipboard fine), #66119, #32791.
What Should Happen?
Alt+V should paste the image out of the box. Suggested fix: have the Windows clipboard helpers prefer pwsh.exe (PowerShell 7) when it is available, falling back to Windows PowerShell 5.1 — the same preference the PowerShell tool already applies. Alternatively (or additionally), surface a clear error when the helper spawn is blocked by policy instead of failing silently.
Error Messages/Logs
(no visible error — Alt+V is a silent no-op; the underlying spawn fails with Win32 error 1260)
Steps to Reproduce
- On Windows 11 with PowerShell 7 installed, block execution of
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exevia policy (AppLocker/SRP; CreateProcess then fails with Win32 error 1260). - Copy any image to the clipboard (e.g. Win+Shift+S).
- In Claude Code, press Alt+V → fails (no paste / "no image").
- Run the helper probe manually with
pwshinstead — it works:
````
pwsh -NoProfile -NonInteractive -Sta -Command "Add-Type -AssemblyName System.Windows.Forms; if (-not [System.Windows.Forms.Clipboard]::ContainsImage()) { exit 1 }"
- If the
powershellname is made to resolve to PowerShell 7, Alt+V works normally — confirming the only blocker is the 5.1 dependency.
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.209 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Windows 11 (10.0.26200), Claude Code native install. PowerShell 7 is present and allowed; only Windows PowerShell 5.1 is blocked by policy.