Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document -AsLiteral switch for ConvertFrom-StringData cmdlet #10769

Open
2 tasks done
ArmaanMcleod opened this issue Jan 5, 2024 · 0 comments
Open
2 tasks done

Document -AsLiteral switch for ConvertFrom-StringData cmdlet #10769

ArmaanMcleod opened this issue Jan 5, 2024 · 0 comments
Labels
hold-for-pr Waiting - for PR merge hold-for-release Waiting - for next release issue-doc-idea Issue - request for new content
Milestone

Comments

@ArmaanMcleod
Copy link

ArmaanMcleod commented Jan 5, 2024

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

Related Source Pull Requests

Related Source Issues

@ArmaanMcleod ArmaanMcleod added issue-doc-idea Issue - request for new content needs-triage Waiting - Needs triage labels Jan 5, 2024
@sdwheeler sdwheeler added hold-for-pr Waiting - for PR merge hold-for-release Waiting - for next release and removed needs-triage Waiting - Needs triage labels Jan 5, 2024
@sdwheeler sdwheeler added this to the Future milestone Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold-for-pr Waiting - for PR merge hold-for-release Waiting - for next release issue-doc-idea Issue - request for new content
Projects
None yet
Development

No branches or pull requests

2 participants