Skip to content

Use %-type filepath shortcuts when creating PATH aliases to reduce the PATH character count. #5951

@DandelionSprout

Description

@DandelionSprout

Relevant area(s)

WinGet CLI

Description of the new feature / enhancement

For whatever unholy reason, Windows OSs have a strictly enforced max length of 2,047 characters for the PATH environment value. And after installing relatively many portable packages from Winget-pkgs through Winget-cli, this can become something of a problem, as Winget-cli is seemingly (Pressure on "seemingly") able to silently fail to add new filepaths to PATH if the PATH character count has exceeded Windows' 2,047 character limit.

Accordingly, I think that it's time to apply File Explorer's %-type shorthands to the PATH values that Winget-cli generate when having installed a portable program.

Proposed technical implementation details

Make it so that situations where Winget-cli would currently create PATH entries with C:\Program Files (x86)\(...) and C:\Program Files\(...), would instead create ones with %ProgramFiles(x86)%\(...) and %ProgramFiles%\(...) respectively.

This would reduce the increased length of PATH by 3 and 2 characters respectively for each installation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureThis is a feature request for the Windows Package Manager client.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions