I am trying to modify a .pgm file sample data below.
<?xml version="1.0" ?>
<Document>
<Attachments>
<File Name="H:\PT000224.pdf"/>
Above I need to change the H: in the file name above to an L: and have it loop through multiple documents and make the same change. I have started with this.
Get-ChildItem "C:\Users\test\Desktop\Change PGM" | ForEach-Object {
$content = Get-Content $_.FullName
$content = ForEach-Object { $content -like "*H:*" -replace "H:","Z:"}
Set-Content $_.FullName $content -Force
}
It goes through everything and changes the value that I want but deletes everything else in the.pgm file.