You can use a regular expression to grab everything between <!–START–> and <!–FINNISH –> and just replace the text in the other file. Here’s an example for a single file. Put this into a loop for all your files and you’re good to go:
$source = Get-Content E:\Temp\Files\HTML\html-source.htm -Raw $destination = Get-Content E:\Temp\Files\HTML\html-dest.htm -Raw $newContent = [regex]::match($source,"<!--START-->[\s\S]+<!--FINNISH -->").value $destination = $destination -replace 'PUT-HERE-THE-CODE',$newContent Set-Content E:\Temp\Files\HTML\html-dest.htm $destination -Encoding UTF8