As part of a larger PowerShell Script, I'm trying to replace two lines within an xml file:
<!--Some description text here-->
<Variable></Variable>
I've been able to replace the text when it's on a single line however I've not been able to find a way to remove new lines from the file.
The obvious thought would be to try to use \r\n but this doesn't work eg:
$XML = Get-Content "Config.xml"
$Pattern = '\r\n'
$Replacement = ""
$NewXML = $XML -replace $Pattern, $Replacement
$NewXML | Set-Content -Path "Config.xml"
I'd expect the above to remove all line breaks in the file but it does nothing.