I set up the pwsh v7, and also set the default terminal, this is work in windows and the terminal of cursor IDE, but the agent still using powershell v5, this lead the syntax of new powershell always error
Steps to Reproduce
ask agent to use terminal, ask to use new syntax (e.g. &&) or print the version
Hey, thanks for the detailed report. This is a known bug: agent shell detection on Windows doesn’t respect terminal.integrated.defaultProfile.windows and picks a different shell than the one selected in the integrated terminal. There’s no ETA for a fix yet, but the issue is being tracked.
As a workaround, try explicitly limiting profiles to PowerShell 7 pwsh only and disabling the default PowerShell profile since it points to PS5. In your User settings.json:
Adjust the pwsh.exe path if PowerShell 7 is installed somewhere else. You can check it with (Get-Command pwsh).Source in PowerShell 7.
After that, fully close Cursor using Quit, not Reload Window, then check in the agent:
$PSVersionTable.PSVersion
If it’s still PS5, also check where.exe powershell and where.exe pwsh in a normal cmd.exe. Sometimes powershell.exe PS5 appears earlier in PATH than pwsh.exe, and the shell detector grabs it first. In that case, either move C:\Program Files\PowerShell\7 higher in the System PATH, or keep only pwsh in PATH.
Let me know if that helps. If not, send the output of where.exe powershell and where.exe pwsh from cmd, and we’ll dig in.
Thanks for your help! after i set the pwsh on top of the path of system env, the agent able to call with pwsh v7
however, the root cause is that the terminal does not respect the ./.vscode/settings.json, in my case, i need to has a project based setup for pwsh with args, but now only following the global settings.json
Glad pwsh 7 got picked up after you reworked your PATH.
About the agent terminal ignoring ./.vscode/settings.json and only reading the global user settings.json, that’s part of the same Windows shell detection problem. The issue is already reported, I’ll add your case about workspace scoped settings and args to the existing ticket. I can’t share an ETA for a fix yet.
As a temporary workaround for project specific pwsh args, you can either launch Cursor from the project directory with an environment variable, or put the args in $PROFILE (PowerShell 7 profile) and branch inside it based on $PWD. It’s a hack, but it should let you keep per project behavior until the fix lands.