microsoft / microsoft/winget-cli

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

Open
#5,951 1 comment 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the WinGet CLI code that creates PATH entries for portable programs, then inspect how it handles the Program Files directories. Done means those entries use %ProgramFiles% and %ProgramFiles(x86)% where applicable, with tests or verification covering the generated PATH values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.