Agent terminal not respect the setting

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

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

Expected Behavior

use the same pwsh of default terminal

Operating System

Windows 10/11

Version Information

Version: 3.5.17 (user setup)
VSCode Version: 1.105.1
Commit: d5b2fc092e16007956c9e5047f76097b9e626ca0
Date: 2026-05-20T02:43:31.559Z
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.22631

For AI issues: which model did you use?

auto

For AI issues: add Request ID with privacy disabled

Request ID: a7b2513d-286e-4e01-9318-d88ed5aefe1c

Additional Information

I config the pwsh v7 in windows as default, it is also default in terminal of cursor. but agent terminal still using old version of powershell v5.

I also try to set the global and project settings.json, enable lagacy terminal tool, and try different settings from other threads.

is it any approach to config the default terminal?

Does this stop you from using Cursor

No - Cursor works, but with this issue

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:

"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.profiles.windows": {
    "PowerShell": {
        "source": "PowerShell",
        "icon": "terminal-powershell",
        "path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
        "args": []
    },
    "Windows PowerShell": null,
    "Command Prompt": null
}

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.