From bb6a95739a730ffafc26fc698e0fb01ba1fd9f25 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Mon, 3 Nov 2025 16:23:15 -0600 Subject: [PATCH 1/4] Add note about double escaping (#12479) --- .../About/about_Wildcards.md | 78 +++++++++++++++++-- .../About/about_Wildcards.md | 78 +++++++++++++++++-- .../About/about_Wildcards.md | 78 +++++++++++++++++-- .../About/about_Wildcards.md | 78 +++++++++++++++++-- 4 files changed, 288 insertions(+), 24 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Wildcards.md index 8a7e3b1217c..d9fd41df974 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Wildcards.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Wildcards.md @@ -1,7 +1,7 @@ --- description: Describes how to use wildcard characters in PowerShell. Locale: en-US -ms.date: 05/14/2024 +ms.date: 11/03/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Wildcards @@ -61,11 +61,6 @@ through **l**, type: Get-ChildItem C:\Techdocs\[a-l]*.txt ``` -> [!NOTE] -> Wildcard matching for filesystem items works differently than for strings. -> For more information, see the _Remarks_ section of the -> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. - There may be cases where you want to match the literal character rather than treat it as a wildcard character. In those cases you can use the backtick (`` ` ``) character to escape the wildcard character so that it is compared @@ -99,6 +94,77 @@ foreach ($point in $p) { } ``` +## Escaping wildcard characters in file and directory names + +> [!NOTE] +> Wildcard matching for filesystem items works differently than for strings. +> For more information, see the _Remarks_ section of the +> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. + +When you try to access a file or directory that contains wildcard characters +the name, you must escape the wildcard characters. Consider the following files: + +```powershell +PS> Get-ChildItem + + Directory: D:\temp\test + +Mode LastWriteTime Length Name +---- ------------- ------ ---- +-a--- 11/3/2025 3:39 PM 41 file[1].txt +-a--- 11/3/2025 3:39 PM 41 file[2].txt +-a--- 11/3/2025 3:39 PM 41 file[3].txt +``` + +The square-bracket (`[]`) characters are wildcards so they must be escaped when +trying to get the file using one of the Item cmdlets, such as `Get-Item`. + +```powershell +PS> Get-Item file`[1`].txt +``` + +However, this example failed because the filename value is bound to the +**Path** parameter, which supports wildcard characters. In this case, the +`` `[ `` pattern resolves to plain `[`, which the **Path** parameter interprets +as a wildcard. There are three ways to resolve this: + +- Escape the backtick characters. + + ```powershell + PS> Get-Item -Path file``[1``].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Put the filename in single quotes so that the backticks aren't expanded + before being bound to the **Path** parameter. + + ```powershell + PS> Get-Item -Path 'file`[1`].txt' + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Use the **LiteralPath** parameter + + ```powershell + PS> Get-Item -LiteralPath file[1].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + ## See also - [about_If][02] diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Wildcards.md index a03dd4cb6a7..e83d7264db9 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Wildcards.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Wildcards.md @@ -1,7 +1,7 @@ --- description: Describes how to use wildcard characters in PowerShell. Locale: en-US -ms.date: 05/14/2024 +ms.date: 11/03/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Wildcards @@ -61,11 +61,6 @@ through **l**, type: Get-ChildItem C:\Techdocs\[a-l]*.txt ``` -> [!NOTE] -> Wildcard matching for filesystem items works differently than for strings. -> For more information, see the _Remarks_ section of the -> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. - There may be cases where you want to match the literal character rather than treat it as a wildcard character. In those cases you can use the backtick (`` ` ``) character to escape the wildcard character so that it is compared @@ -99,6 +94,77 @@ foreach ($point in $p) { } ``` +## Escaping wildcard characters in file and directory names + +> [!NOTE] +> Wildcard matching for filesystem items works differently than for strings. +> For more information, see the _Remarks_ section of the +> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. + +When you try to access a file or directory that contains wildcard characters +the name, you must escape the wildcard characters. Consider the following files: + +```powershell +PS> Get-ChildItem + + Directory: D:\temp\test + +Mode LastWriteTime Length Name +---- ------------- ------ ---- +-a--- 11/3/2025 3:39 PM 41 file[1].txt +-a--- 11/3/2025 3:39 PM 41 file[2].txt +-a--- 11/3/2025 3:39 PM 41 file[3].txt +``` + +The square-bracket (`[]`) characters are wildcards so they must be escaped when +trying to get the file using one of the Item cmdlets, such as `Get-Item`. + +```powershell +PS> Get-Item file`[1`].txt +``` + +However, this example failed because the filename value is bound to the +**Path** parameter, which supports wildcard characters. In this case, the +`` `[ `` pattern resolves to plain `[`, which the **Path** parameter interprets +as a wildcard. There are three ways to resolve this: + +- Escape the backtick characters. + + ```powershell + PS> Get-Item -Path file``[1``].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Put the filename in single quotes so that the backticks aren't expanded + before being bound to the **Path** parameter. + + ```powershell + PS> Get-Item -Path 'file`[1`].txt' + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Use the **LiteralPath** parameter + + ```powershell + PS> Get-Item -LiteralPath file[1].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + ## See also - [about_If][02] diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Wildcards.md index 68a6b7bfd84..83eb1083f93 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Wildcards.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Wildcards.md @@ -1,7 +1,7 @@ --- description: Describes how to use wildcard characters in PowerShell. Locale: en-US -ms.date: 05/14/2024 +ms.date: 11/03/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Wildcards @@ -61,11 +61,6 @@ through **l**, type: Get-ChildItem C:\Techdocs\[a-l]*.txt ``` -> [!NOTE] -> Wildcard matching for filesystem items works differently than for strings. -> For more information, see the _Remarks_ section of the -> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. - There may be cases where you want to match the literal character rather than treat it as a wildcard character. In those cases you can use the backtick (`` ` ``) character to escape the wildcard character so that it is compared @@ -99,6 +94,77 @@ foreach ($point in $p) { } ``` +## Escaping wildcard characters in file and directory names + +> [!NOTE] +> Wildcard matching for filesystem items works differently than for strings. +> For more information, see the _Remarks_ section of the +> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. + +When you try to access a file or directory that contains wildcard characters +the name, you must escape the wildcard characters. Consider the following files: + +```powershell +PS> Get-ChildItem + + Directory: D:\temp\test + +Mode LastWriteTime Length Name +---- ------------- ------ ---- +-a--- 11/3/2025 3:39 PM 41 file[1].txt +-a--- 11/3/2025 3:39 PM 41 file[2].txt +-a--- 11/3/2025 3:39 PM 41 file[3].txt +``` + +The square-bracket (`[]`) characters are wildcards so they must be escaped when +trying to get the file using one of the Item cmdlets, such as `Get-Item`. + +```powershell +PS> Get-Item file`[1`].txt +``` + +However, this example failed because the filename value is bound to the +**Path** parameter, which supports wildcard characters. In this case, the +`` `[ `` pattern resolves to plain `[`, which the **Path** parameter interprets +as a wildcard. There are three ways to resolve this: + +- Escape the backtick characters. + + ```powershell + PS> Get-Item -Path file``[1``].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Put the filename in single quotes so that the backticks aren't expanded + before being bound to the **Path** parameter. + + ```powershell + PS> Get-Item -Path 'file`[1`].txt' + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Use the **LiteralPath** parameter + + ```powershell + PS> Get-Item -LiteralPath file[1].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + ## See also - [about_If][02] diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md index 6e65740e674..7b644d13295 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md @@ -1,7 +1,7 @@ --- description: Describes how to use wildcard characters in PowerShell. Locale: en-US -ms.date: 05/14/2024 +ms.date: 11/03/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Wildcards @@ -61,11 +61,6 @@ through **l**, type: Get-ChildItem C:\Techdocs\[a-l]*.txt ``` -> [!NOTE] -> Wildcard matching for filesystem items works differently than for strings. -> For more information, see the _Remarks_ section of the -> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. - There may be cases where you want to match the literal character rather than treat it as a wildcard character. In those cases you can use the backtick (`` ` ``) character to escape the wildcard character so that it is compared @@ -99,6 +94,77 @@ foreach ($point in $p) { } ``` +## Escaping wildcard characters in file and directory names + +> [!NOTE] +> Wildcard matching for filesystem items works differently than for strings. +> For more information, see the _Remarks_ section of the +> [DirectoryInfo.GetFiles(String, EnumerationOptions)][05] method. + +When you try to access a file or directory that contains wildcard characters +the name, you must escape the wildcard characters. Consider the following files: + +```powershell +PS> Get-ChildItem + + Directory: D:\temp\test + +Mode LastWriteTime Length Name +---- ------------- ------ ---- +-a--- 11/3/2025 3:39 PM 41 file[1].txt +-a--- 11/3/2025 3:39 PM 41 file[2].txt +-a--- 11/3/2025 3:39 PM 41 file[3].txt +``` + +The square-bracket (`[]`) characters are wildcards so they must be escaped when +trying to get the file using one of the Item cmdlets, such as `Get-Item`. + +```powershell +PS> Get-Item file`[1`].txt +``` + +However, this example failed because the filename value is bound to the +**Path** parameter, which supports wildcard characters. In this case, the +`` `[ `` pattern resolves to plain `[`, which the **Path** parameter interprets +as a wildcard. There are three ways to resolve this: + +- Escape the backtick characters. + + ```powershell + PS> Get-Item -Path file``[1``].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Put the filename in single quotes so that the backticks aren't expanded + before being bound to the **Path** parameter. + + ```powershell + PS> Get-Item -Path 'file`[1`].txt' + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + +- Use the **LiteralPath** parameter + + ```powershell + PS> Get-Item -LiteralPath file[1].txt + + Directory: D:\temp\test + + Mode LastWriteTime Length Name + ---- ------------- ------ ---- + -a--- 11/3/2025 3:39 PM 41 file[1].txt + ``` + ## See also - [about_If][02] From c4961eb5730e51304b82ed82fa663528f966c56f Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Mon, 3 Nov 2025 16:57:03 -0600 Subject: [PATCH 2/4] Fix broken link (#12480) --- .../About/about_Environment_Variables.md | 2 +- .../About/about_Environment_Variables.md | 2 +- .../About/about_Environment_Variables.md | 2 +- .../docs-conceptual/install/Installing-PowerShell-on-macOS.md | 2 +- reference/docs-conceptual/install/install-alpine.md | 2 +- reference/docs-conceptual/install/install-debian.md | 2 +- reference/docs-conceptual/install/install-rhel.md | 2 +- reference/docs-conceptual/install/install-ubuntu.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 245d8dc54de..ff22c0336e2 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -570,5 +570,5 @@ or `NO_COLOR` environment variables. [10]: about_Update_Notifications.md [11]: about_Variables.md [12]: https://no-color.org/ -[13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[13]: https://specifications.freedesktop.org/basedir/latest/ [14]: xref:PowerShellGet.Install-Module diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index fabca7a7bc5..dd6100831ca 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -607,5 +607,5 @@ or `NO_COLOR` environment variables. [10]: about_Update_Notifications.md [11]: about_Variables.md [12]: https://no-color.org/ -[13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[13]: https://specifications.freedesktop.org/basedir/latest/ [14]: xref:PowerShellGet.Install-Module diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index d1ed8e17e1d..0a7fe026269 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -623,5 +623,5 @@ or `NO_COLOR` environment variables. [10]: about_Update_Notifications.md [11]: about_Variables.md [12]: https://no-color.org/ -[13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[13]: https://specifications.freedesktop.org/basedir/latest/ [14]: xref:PowerShellGet.Install-Module diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md index d3289536ba6..5ae82e19cce 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md +++ b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md @@ -313,5 +313,5 @@ support those methods. [21]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-osx-arm64.tar.gz [22]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-osx-x64.pkg [23]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/powershell-7.5.4-osx-x64.tar.gz -[24]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[24]: https://specifications.freedesktop.org/basedir/latest/ [25]: https://support.apple.com/102445 diff --git a/reference/docs-conceptual/install/install-alpine.md b/reference/docs-conceptual/install/install-alpine.md index 2ae2e0f0502..c4a07b4c763 100644 --- a/reference/docs-conceptual/install/install-alpine.md +++ b/reference/docs-conceptual/install/install-alpine.md @@ -105,5 +105,5 @@ Microsoft can't support those methods. [02]: #supported-versions [03]: https://aka.ms/PowerShell-Release?tag=stable -[04]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[04]: https://specifications.freedesktop.org/basedir/latest/ [05]: install-other-linux.md#binary-archives diff --git a/reference/docs-conceptual/install/install-debian.md b/reference/docs-conceptual/install/install-debian.md index 0199777545e..c272c27d85c 100644 --- a/reference/docs-conceptual/install/install-debian.md +++ b/reference/docs-conceptual/install/install-debian.md @@ -142,5 +142,5 @@ Microsoft can't support those methods. [01]: #supported-versions [02]: https://aka.ms/PowerShell-Release?tag=stable [03]: https://packages.microsoft.com -[04]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[04]: https://specifications.freedesktop.org/basedir/latest/ [05]: install-other-linux.md#binary-archives diff --git a/reference/docs-conceptual/install/install-rhel.md b/reference/docs-conceptual/install/install-rhel.md index 4ebc9fd6453..f00e2909edf 100644 --- a/reference/docs-conceptual/install/install-rhel.md +++ b/reference/docs-conceptual/install/install-rhel.md @@ -125,5 +125,5 @@ Microsoft can't support those methods. [01]: #supported-versions [02]: https://aka.ms/PowerShell-Release?tag=stable [03]: https://packages.microsoft.com -[04]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[04]: https://specifications.freedesktop.org/basedir/latest/ [05]: install-other-linux.md#binary-archives diff --git a/reference/docs-conceptual/install/install-ubuntu.md b/reference/docs-conceptual/install/install-ubuntu.md index 47914094d5d..f9e04efe2a2 100644 --- a/reference/docs-conceptual/install/install-ubuntu.md +++ b/reference/docs-conceptual/install/install-ubuntu.md @@ -164,5 +164,5 @@ Microsoft can't support those methods. [04]: #supported-versions [05]: https://aka.ms/PowerShell-Release?tag=stable [06]: https://packages.microsoft.com -[07]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[07]: https://specifications.freedesktop.org/basedir/latest/ [08]: install-other-linux.md#binary-archives From b6a9be7bab9b37eba10ea0245f766d0e0a72c1be Mon Sep 17 00:00:00 2001 From: Ali Robertson Date: Wed, 5 Nov 2025 01:29:35 +1100 Subject: [PATCH 3/4] using-aliases.md - fix 'mv' typo (#12481) * using-aliases.md - fix typo * Fix alias for move command in documentation --- reference/docs-conceptual/learn/shell/using-aliases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/docs-conceptual/learn/shell/using-aliases.md b/reference/docs-conceptual/learn/shell/using-aliases.md index 5c86582e15b..9150a265225 100644 --- a/reference/docs-conceptual/learn/shell/using-aliases.md +++ b/reference/docs-conceptual/learn/shell/using-aliases.md @@ -81,7 +81,7 @@ alias: | `dir` | `ls` | `Get-ChildItem` | `gci`, `dir`, `ls` | | `echo` | `echo` | `Write-Output` | `write` `echo` | | `md` | `mkdir` | `New-Item` | `ni` | -| `move` | `mv` | `Move-Item` | `mi`, `move`, `mi` | +| `move` | `mv` | `Move-Item` | `mi`, `move`, `mv` | | `popd` | `popd` | `Pop-Location` | `popd` | | | `pwd` | `Get-Location` | `gl`, `pwd` | | `pushd` | `pushd` | `Push-Location` | `pushd` | From b013dd8a105771aa4e07d34f377e452b6f51841f Mon Sep 17 00:00:00 2001 From: "Mike F. Robbins" <6719572+mikefrobbins@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:58:51 -0600 Subject: [PATCH 4/4] Updated azps quick filter link for 14.6.0 (#12482) --- reference/module/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/module/index.md b/reference/module/index.md index d8929236f43..69705ac9211 100644 --- a/reference/module/index.md +++ b/reference/module/index.md @@ -12,7 +12,7 @@ ms.manager: sewhee ms.product: powershell ms.topic: landing-page quickFilterColumn1: powershell-7.4,windowsserver2025-ps -quickFilterColumn2: azps-14.5.0,sqlserver-ps +quickFilterColumn2: azps-14.6.0,sqlserver-ps quickFilterColumn3: graph-powershell-1.0,systemcenter-ps-2022 title: PowerShell Module Browser ---