Random powershell script running on startup

Describe the Bug

When opening the cursor executable, 3 powershell windows will open, echo ‘test’, then close immediately.

Steps to Reproduce

Open Cursor

Expected Behavior

No powershell scripts will display and app will open normally

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.40 (system setup)
VSCode Version: 1.105.1
Commit: f5edf5b2fdaaf0f44d324fa092a32515ce114c90
Date: 2025-11-30T16:13:36.488Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

Additional Information

The powershell script executed appears to be dumping environment variables

Set-Location 'C:\Users\Austin\AppData\Local\Programs\cursor'

# Execute user command
echo test
$COMMAND_EXIT_CODE = $LASTEXITCODE


function Dump-PowerShellState {
    param(
        [Parameter(Mandatory = $true)]
        [string]$OutputFile
    )

    function Emit {
        param([string]$Content)
        Add-Content -Path $OutputFile -Value $Content -Encoding UTF8
    }

    if (Test-Path $OutputFile) {
        Remove-Item $OutputFile -Force
    }
    New-Item -Path $OutputFile -ItemType File -Force | Out-Null
    #Log-Timing "file_init"

    Emit $PWD.Path
    #Log-Timing "working_dir"

    $envVars = Get-ChildItem Env: | Sort-Object Name
    foreach ($var in $envVars) {
        $encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([string]$var.Value))
        Emit ('Set-Item -LiteralPath ''Env:{0}'' -Value ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(''{1}'')))' -f $var.Name, $encoded)
    }
    #Log-Timing "environment"

    $aliases = Get-Alias | Sort-Object Name
    foreach ($alias in $aliases) {
        $definition = $alias.Definition

        if ($alias.Options -band [System.Management.Automation.ScopedItemOptions]::ReadOnly) {
        }
        elseif ($alias.Options -band [System.Management.Automation.ScopedItemOptions]::Constant) {
        }
        elseif ($alias.Options -band [System.Management.Automation.ScopedItemOptions]::AllScope) {
        }
        else {
            Emit ('Set-Alias -Name "{0}" -Value "{1}"' -f $alias.Name, $definition)
        }
    }

    #Log-Timing "finalize"
}

Dump-PowerShellState -OutputFile "C:\Users\Austin\AppData\Local\Temp\ps-state-out-a654489d-81f8-411b-b35d-83b7c5903cbb.txt"

exit $COMMAND_EXIT_CODE

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. When launching Cursor, 3 PowerShell windows open, run echo ‘test’ and dump environment variables to a temp file, then close. Looks like a bug in shell initialization on Windows.

Can you please share:

  • result of running cursor --disable-extensions (does the issue reproduce)
  • screenshot from command palette → Developer: Open Process Explorer (powershell.exe processes and their Command Line) right after start
  • errors from Console (Help > Toggle Developer Tools > Console) on restart
  • confirmation of creation of file C:\Users\<user>\AppData\Local\Temp\ps-state-out-*.txt
  • result of test with “user setup” installation (download user version from Download · Cursor site, instead of “system setup”)

This will help localize the problem.

Hello,

I ended up solving this manually by editing the js bundle (not ideal but it fixed it) at C:\Program Files\cursor\resources\app\out\vs\workbench\workbench.desktop.main.js.

There was a hardcoded echo test in the bundle, not sure why. But removing that resolved the issue.

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