Fix Start-Process to handle shell: URIs on Windows#27032
Open
evalentini wants to merge 2 commits intoPowerShell:masterfrom
Open
Fix Start-Process to handle shell: URIs on Windows#27032evalentini wants to merge 2 commits intoPowerShell:masterfrom
Start-Process to handle shell: URIs on Windows#27032evalentini wants to merge 2 commits intoPowerShell:masterfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
5 tasks
kilasuit
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fix
Start-Processto handle Windows shell: URIs by detecting theshell:prefix and bypassingCommandDiscoverylookup. Instead pass the URI directly toShellExecute.Fixes #25397
PR Context
Problem
On Windows,
Start-Processfails when givenshell:URIs with a\likeshell:::{8E908FC9-BECC-40f6-915B-F4CA0E70D03D}\Advanced. The root cause is in CommandSearcher.CanDoPathLookup(). When the command contains a backslash, it returns DirectorySeparator, which triggers a code path in setupPathSearcher() that calls ResolvePSPath() → GetNextLiteralPathThatExists() → LocationGlobber.GetProviderPath(). This parses the shell: prefix as a PowerShell provider name and throws ProviderNotFoundException. Without the backslash (shell:::{GUID}), the command takes a different code path and works.Solution
Add a check in
StartProcessCommand.BeginProcessing()to detect shell: URIs on Windows and skip theCommandDiscoverylookup. Instead pass the URI directly toShellExecute. Cmldet Working Group recommends this solution.Add test case in "Bug fixes" block to verify
shell:URIs don't throwProviderNotFoundException.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header