Open
Description
Prerequisites
- Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
- Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new
Get-Foo
cmdlet" instead of "New cmdlet."
Summary
Need to document the -AsLiteral
switch for ConvertFrom-StringData
cmdlet, which auto escapes input strings coming from pipeline.
Details
Currently if you want to escape strings before piping to ConvertFrom-StringData
, you need to replace or escape beforehand:
> 'a=b\C' | ConvertFrom-StringData
ConvertFrom-StringData: Invalid pattern 'b\C' at offset 3. Unrecognized escape sequence \C.
> [Regex]::Escape('a=b\C') | ConvertFrom-StringData
Name Value
---- -----
a b\C
With the new -AsLiteral
switch, it escapes input strings automatically:
'a=b\C' | ConvertFrom-StringData -AsLiteral
Name Value
---- -----
a b\C
Articles
- reference/7.4/Microsoft.PowerShell.Utility/ConvertFrom-StringData.md