Hey, thanks for the report.
This is a new bug with the PowerShell wrapper script that Cursor uses to run commands through the agent. The issue is that the script tries to collect environment variables via Get-ChildItem Env:, and on Windows the same variable (Path, TEMP, etc.) can exist in multiple scopes (Process, User, Machine), and the script can’t handle that.
There isn’t an official fix yet, but there’s a workaround that has helped with other PowerShell issues caused by the same wrapper script:
- Open Cursor Settings (
Ctrl+Shift+J) - Go to Agents, then find Legacy Terminal Tool
- Turn it on
- Press
Ctrl+Shift+Pthen run Terminal: Kill All Terminals - Fully restart Cursor
- Try the commands again
Legacy Terminal Tool uses the older implementation, which may avoid this wrapper script issue.
If it doesn’t help, let me know.
Related issues with the same wrapper script:
- PowerShell in Cursor is consistently broken — endless syntax errors (not isolated cases) (CMD syntax in PowerShell)
- Agent mode fails on Windows with PowerShell Constrained Language Mode (Constrained Language Mode)