Replace Content in HTML Files in a Folder


/ Published in: Windows PowerShell
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $Path = "C:\Path\"
  2. $HtmlFiles = Get-ChildItem $Path -Filter *.* -Recurse
  3. foreach ($file in $HtmlFiles) {
  4. Write-Host "Examining" $file
  5. (Get-Content $file.FullName) | Foreach-Object {$_ -replace "REPLACEME", "NEWCONTENT"} | Set-Content $file.FullName
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.