Lubchak Lubchak - 5 months ago 44
PowerShell Question

PowerShell reading property file

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


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 \\:

ConvertFrom-StringData ((Get-Content test.conf -Raw) -replace '\\','\\')