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 8a7e3b1217ce..d9fd41df9740 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_Environment_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 245d8dc54de8..ff22c0336e25 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.4/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Wildcards.md index a03dd4cb6a7a..e83d7264db96 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_Environment_Variables.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index fabca7a7bc5f..dd6100831caf 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.5/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Wildcards.md index 68a6b7bfd84c..83eb1083f93f 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_Environment_Variables.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index d1ed8e17e1d0..0a7fe0262696 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/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Wildcards.md index 6e65740e674e..7b644d13295b 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] diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md index d3289536ba62..5ae82e19cce7 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 2ae2e0f05020..c4a07b4c763e 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 0199777545e8..c272c27d85c7 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 4ebc9fd6453d..f00e2909edf1 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 47914094d5d0..f9e04efe2a24 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 diff --git a/reference/docs-conceptual/learn/shell/using-aliases.md b/reference/docs-conceptual/learn/shell/using-aliases.md index 5c86582e15b8..9150a2652252 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` | diff --git a/reference/module/index.md b/reference/module/index.md index d8929236f430..69705ac92111 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 ---