Skip to content

Windows 11: installed Edit is shadowed by the inbox System32 edit.exe #951

Description

@ywenhao

I am seeing the same problem on Windows 11 after installing the current Microsoft Edit release according to the repository instructions.

Reproduction

  1. Install the newer Microsoft Edit release (for example, 2.0.0) through the documented installation method.
  2. Open a new PowerShell terminal and run edit.
  3. edit still resolves to C:\Windows\System32\edit.exe (the older inbox version, 1.2.1), because the System32 entry has higher PATH precedence than the newly installed version-specific directory.
  4. Get-Command edit.exe -All shows both executables, but the old system copy is selected first.

This means a normal edit invocation does not use the installed update, even though the installation completed successfully. The PATH workaround is also fragile because the package directory changes on every version update.

For now I have to add a function to my PowerShell $PROFILE that selects the newest installed executable by version:

function edit {
    $edit = Get-Command edit.exe -All |
        Where-Object {
            $_.Version -ge [version]'2.0.0.0'
        } |
        Sort-Object Version -Descending |
        Select-Object -First 1

    if ($edit) {
        & $edit.Source @args
    }
    else {
        & "$env:WINDIR\System32\edit.exe" @args
    }
}

Could the Windows distribution provide a stable shim/link directory or otherwise ensure that the current installed edit.exe takes precedence over the inbox System32 copy? The fix should continue working across upgrades without requiring users to edit PATH or their PowerShell profile each time.

Related issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions