Skip to content

Fix parsing WinGet uninstall commands with dotted arguments - #1017

Open
BreezeDelegate wants to merge 2 commits into
BCUninstaller:masterfrom
BreezeDelegate:fix/winget-command-parsing-971
Open

BreezeDelegate wants to merge 2 commits into
BCUninstaller:masterfrom
BreezeDelegate:fix/winget-command-parsing-971

Conversation

@BreezeDelegate

@BreezeDelegate BreezeDelegate commented Sep 26, 2026 •

Copy link
Copy Markdown

Summary

Fix command parsing for uninstall strings that use a bare executable name with dotted arguments, such as:

winget uninstall --product-code Exiv2.Exiv2_Microsoft.Winget.Source_8wekyb3d8bbwe

SeparateArgsFromCommand currently sees the first . in the package identifier and treats the entire command line as the executable path. This makes Process.Start try to launch the full string as a file.

The same parser failure also explains #779, which reports the equivalent command shape with mikf.gallery-dl_Microsoft.Winget.Source_8wekyb3d8bbwe.

The existing parser now gets the first chance to split valid paths and executable names. A bare-executable fallback is only used when dotted arguments otherwise leave the whole command looking like a filename. This preserves existing unquoted executable names that contain spaces.

Fixes #971.
Fixes #779.

Validation

  • current master: the reported WinGet command is parsed as the entire executable path, reproducing the failure from Consistently fails to uninstall WinGet packages #971/Error: File doesn't exist (it does) #779
  • actual ProcessTools.SeparateArgsFromCommand matrix: 7/7 passed under a self-contained win-x64 run, covering both reported WinGet product codes, cmd, msiexec, quoted/unquoted paths with spaces, and an unquoted executable name containing spaces
  • adversarial regression check: the first implementation parsed My Uninstaller.exe /S as My + Uninstaller.exe /S; the final implementation preserves My Uninstaller.exe + /S
  • KlocTools Release build: 0 warnings, 0 errors
  • git diff --check: clean

A full solution test run is not available on the Linux validation host because UninstallTools uses COM references requiring the Windows/.NET Framework MSBuild path.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistently fails to uninstall WinGet packages Error: File doesn't exist (it does)

1 participant