Skip to content

Commit 4201a9b

Browse files
sdwheelerCopilot
andauthored
Fixes #12606 - Fix ambiguity with parameter aliases (#12652)
* Fix ambiguity with parameter aliases * Update reference/docs-conceptual/learn/shell/using-aliases.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent dff3207 commit 4201a9b

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

reference/docs-conceptual/learn/shell/using-aliases.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: This article describes how to use aliases in PowerShell.
3-
ms.date: 11/21/2025
3+
ms.date: 01/13/2026
44
title: Using aliases
55
---
66
# Using aliases
@@ -113,9 +113,25 @@ For more information, see the [Alias attribute][03] documentation.
113113

114114
In addition to parameter aliases, PowerShell lets you specify the parameter name using the fewest
115115
characters needed to uniquely identify the parameter. For example, the `Get-ChildItem` cmdlet has
116-
the **Recurse** and **ReadOnly** parameters. To uniquely identify the Recurse parameter, you only
117-
need to provide `-Rec`. If you combine that with the command alias, `Get-ChildItem -Recurse` can be
118-
shortened to `dir -Rec`.
116+
the **Filter** and **Force** parameters. Using `-F` is ambiguous because both parameters start with
117+
the letter `F`. If you try to use `-F`, PowerShell returns an error:
118+
119+
```powershell
120+
PS> Get-ChildItem -f
121+
```
122+
123+
```Output
124+
Get-ChildItem : Parameter cannot be processed because the parameter name 'f' is ambiguous. Possible
125+
matches include: -Filter -Force.
126+
```
127+
128+
To uniquely identify the **Filter** parameter, you need to use `-Fi`.
129+
130+
> [!NOTE]
131+
> The `Get-ChildItem` cmdlet also has a dynamic parameter, `-File`. Using `-f`, `-fi` and `-fil`
132+
> doesn't create ambiguity with `-File` because `-File` is a dynamic `FileSystem` provider
133+
> parameter. PowerShell binds dynamic parameters after binding static parameters. The only way to
134+
> specify the parameter is to use the full name, `-File`.
119135
120136
## Don't use aliases in scripts
121137

0 commit comments

Comments
 (0)