I recently ran into some strange errors with a few file-related PowerShell cmdlets.
Get-Content and
Set-Content invocations worked fine on most files but threw errors claiming the file didn't exist if square brackets were involved in the name. Apparently this happens because the
-like wildcard syntax treats e.g.
[abc] as matching any one of
a,
b, or
c. To suppress this matching, use
-LiteralPath rather than the implied
-Path parameter.
No comments:
Post a Comment