Skip to content

Instantly share code, notes, and snippets.

@sofferm
Created May 21, 2025 13:12
Show Gist options
  • Select an option

  • Save sofferm/9e099fe60ff92b552a7e8c94fdaa1666 to your computer and use it in GitHub Desktop.

Select an option

Save sofferm/9e099fe60ff92b552a7e8c94fdaa1666 to your computer and use it in GitHub Desktop.
Suchen/Ersetzen in Textdateien
$configFiles=get-childitem -Include *.html,*.xml -Recurse -Path C:\data\myproject
foreach ($file in $configFiles)
{
(Get-Content $file.PSPath) |
Foreach-Object {$_ -replace "server.invalid.com", "new.example.org"} |
Foreach-Object {$_ -replace "/OldFolder/", "/NewFolder/"} |
Set-Content $file.PSPath
Write-Output $file.PSPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment