I need read properties from config file. I can do it with
ConvertFrom-StringData(Get-Content test.conf | out-String)
But in this file I have param
username=intranet\sysTestAcc
And when it's try to parse it I had error: Unrecognized escape sequence \s.
How can I fix that with script? I can't change file before running script.
Replace the \
with \\
:
# The first '\\' is a regex with a '\' escape to create a literal '\'
# The second '\\' is a literal replacement (non-regex) that inserts two '\'
ConvertFrom-StringData ((Get-Content test.conf -Raw) -replace '\\','\\')
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments