Repository navigation
Fix PowerShell cmdlets running winget.exe from the current directory - #6684
AmirMS (AmelBawa-msft) wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The diagnostic retry can execute an unsafe current-directory WinGet executable after safe resolution rejects it, while quoted absolute PATH entries are incorrectly ignored.
2 open issues
What changed in this PR
This PR updates the PowerShell client engine to resolve winget.exe explicitly from PATH rather than relying on process lookup that also searches the current directory.
Changes:
- Searches fully qualified PATH entries and reports file-not-found when no match exists.
- Adds tests for PATH ordering and rejection of current-directory-relative entries.
- Adds a release note for the affected PowerShell cmdlets.
| File | Description |
|---|---|
src/PowerShell/Microsoft.WinGet.UnitTests/WingetCLIWrapperTests.cs |
Tests first-match selection and rejection of relative PATH entries. |
src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/WingetCLIWrapper.cs |
Adds explicit PATH resolution before launching WinGet. |
doc/release-notes/1.31/powershell-winget-path-resolution.md |
Documents the fix for assert and repair cmdlets. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The absolute-path launch bypasses PATH and app-execution alias checks, allowing Repair to report success while PATH remains broken or an alias remains disabled.
1 open issue
2 resolved since last review
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive executable-selection change needs human confirmation that the reported Windows checks cover this exact diff, since the PR description ties validation to an uncommitted follow-up.
No open issues 🎉
1 resolved since last review
Review effort: Balanced


📖 Description
Resolve WinGet for
Assert-WinGetPackageManagerandRepair-WinGetPackageManagerfrom the Microsoft-published, Store-signed App Installer package instead of CWD/PATH. Preserve PATH/alias checks and consistent PATH repair; development builds keep thewingetdevalias.🔗 References
🔍 Validation
🤖 AI Assistance
AI assisted with the package-based implementation, regression tests, local validation and this description.
📋 Issue Type
Microsoft Reviewers: Open in CodeFlow