Repository navigation
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Description
Steps to reproduce
PS> New-Item [out].txt
Directory: F:\tmp\modules\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/13/2019 9:29 AM 0 [out].txt
PS> Set-Content -Path '.\`[out`].txt' -Value "value"
Set-Content : An object at the specified path .\`[out`].txt does not exist, or has been filtered by the -Include or -Exclude parameter.
At line:1 char:1
+ Set-Content -Path '.\`[out`].txt' -Value "value"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.String[]:String[]) [Set-Content], Exception
+ FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.SetContentCommand
PS> Add-Content -Path '.\`[out`].txt' -Value "value"
Add-Content : An object at the specified path .\`[out`].txt does not exist, or has been filtered by the -Include or -Exclude parameter.
At line:1 char:1
+ Add-Content -Path '.\`[out`].txt' -Value "value"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.String[]:String[]) [Add-Content], Exception
+ FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.AddContentCommand
Expected behavior
Clear-Content and Get-Content work fine with the same path
PS> Get-Content -Path '.\`[out`].txt'
Content
PS:114> Clear-Content -Path '.\`[out`].txt'
PS:115> dir
Directory: F:\tmp\modules\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/13/2019 9:32 AM 0 [out].txt
Set-Content and Add-Content should also work with that path.
Actual behavior
Add-Content and Set-Content don't work with the path.
Environment data
Name Value
---- -----
PSVersion 6.2.0
PSEdition Core
GitCommitId 6.2.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Activity
mklement0 commentedon Nov 7, 2019
Related:
Backtick escaping inconsistent #7999 - inconsistent escaping in general
Some scripts / files with wildcard metacharacter [ in the file name or path cannot be invoked or redirected to #4726 -
>/>>unexpectedly treating the operand as a wildcardSet-Content should not allow writing to multiple files using wildcards #6729 -
Set-Content, unlikeOut-Content, unexpectedly allowing multiple files to be overwritten when a wildcard matches multiple existing files.Overall, though technically a breaking change, I think the right answer is to treat all output file paths as literals.
Use of wildcard patterns in these scenarios is unexpected, mostly useless and always fraught.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.