Skip to content

Get-Command: resolve noun-only names with the default verb#27672

Open
TheD0ubleC wants to merge 1 commit into
PowerShell:masterfrom
TheD0ubleC:agent/get-command-default-verb
Open

Get-Command: resolve noun-only names with the default verb#27672
TheD0ubleC wants to merge 1 commit into
PowerShell:masterfrom
TheD0ubleC:agent/get-command-default-verb

Conversation

@TheD0ubleC

Copy link
Copy Markdown

PR Summary

Make Get-Command retry a literal noun-only name with the default Get- verb when the exact lookup fails, matching normal command invocation.

Exact command names still take precedence. Wildcard, fuzzy, abbreviated, path, and module-qualified lookups keep their existing behavior, and the retry uses the same command type and module filters as the original lookup.

PR Context

Command discovery already prepends Get- when a noun-only command cannot be found. Get-Command performs its own enumeration and did not apply that fallback, so invoking location worked while Get-Command location returned CommandNotFoundException.

Fixes #17438

Testing

  • Start-PSBuild -UseNuGetOrg -SkipRoslynAnalyzers
  • Start-PSPester -Path test/powershell/engine/Basic/CommandDiscovery.Tests.ps1 -UseNuGetOrg
    • 40 passed, 0 failed, 2 inconclusive pre-existing tests

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Existing files retain their copyright headers
  • Added regression tests
  • No breaking changes

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@TheD0ubleC

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@TheD0ubleC
TheD0ubleC marked this pull request as ready for review July 10, 2026 11:38
@TheD0ubleC
TheD0ubleC requested a review from a team as a code owner July 10, 2026 11:38
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@kilasuit kilasuit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pulled down, built and tested this PR from a visual UI perspective and approve this PR.

@kilasuit kilasuit added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-Command can't resolve commands entered by omitting the Get-* verb, though command discovery can

2 participants