Cursor keeps using old Microsoft PowerShell

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I have chosen a default profile that’s using the modern pwsh (7.5.0+) but the agent is still issuing commands in old Microsoft PowerShell confirmed with $PSVersionTable.PSVersion

Steps to Reproduce

Install modern PowerShell and change default profile and then ask an agent to run $PSVersionTable.PSVersion

Expected Behavior

$PSVersionTable.PSVersion when executed by an agent report

Major Minor Patch PreReleaseLabel BuildLabel


7 5 4

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.4.7 (user setup)
VSCode Version: 1.105.1
Commit: ca0f9bf806f235ea014a22712cbcbf5e88ca77e0
Date: 2026-01-20T20:52:38.077Z
Build Type: Stable
Release Track: Early Access
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey @Frulfump!

Just tried this out. As soon as I installed Powershell 7 (pwsh.exe), closed and reopend Cursor, I started to see Powershell 7 being used.

The trick is making sure that pwsh.exe comes first in the PATH before powershell.exe. Your milage may vary based on your setup.

This is the little script that Cursor wrote for me to do that (run as administrator)

# Script to reorder PATH so pwsh.exe (PowerShell 7) comes before powershell.exe (Windows PowerShell 5.1)
# This script must be run as Administrator

# Check if running as admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

if (-not $isAdmin) {
    Write-Host "ERROR: This script must be run as Administrator!" -ForegroundColor Red
    Write-Host "Right-click PowerShell and select 'Run as Administrator', then run this script again." -ForegroundColor Yellow
    exit 1
}

Write-Host "Reading current system PATH..." -ForegroundColor Cyan
$systemPath = [Environment]::GetEnvironmentVariable("Path", "Machine") -split ';' | Where-Object { $_ -ne '' }

Write-Host "`nCurrent PATH order (PowerShell-related entries):" -ForegroundColor Yellow
$systemPath | Select-String -Pattern 'PowerShell|powershell' | ForEach-Object { Write-Host "  $_" }

# Reorder: PowerShell 7 first, then everything else (keeping all entries including duplicates)
Write-Host "`nReordering PATH..." -ForegroundColor Cyan
$newSystemPath = @()
$newSystemPath += $systemPath | Where-Object { $_ -like 'C:\Program Files\PowerShell\7*' }
$newSystemPath += $systemPath | Where-Object { $_ -notlike 'C:\Program Files\PowerShell\7*' }

$newSystemPathString = $newSystemPath -join ';'

Write-Host "Updating system PATH..." -ForegroundColor Cyan
[Environment]::SetEnvironmentVariable("Path", $newSystemPathString, "Machine")

Write-Host "`nPATH updated successfully!" -ForegroundColor Green
Write-Host "`nNew PATH order (PowerShell-related entries):" -ForegroundColor Yellow
$newSystemPath | Select-String -Pattern 'PowerShell|powershell' | ForEach-Object { Write-Host "  $_" }

Write-Host "`nNote: You may need to restart your terminal or log out/in for changes to take full effect." -ForegroundColor Cyan

It would be handy if there was a better way to define what shell you want to use (noted).

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.