$filePath = "D:\ps\Config\*.config" # Get the files from the folder and iterate using Foreach Get-ChildItem $filePath -Recurse | ForEach-Object { # Read the file and use replace() (Get-Content $_).Replace('2015','2022') | Set-Content $_ } Get-ChildItem $filePath -Recurse | ForEach-Object { (Get-Content $_).Replace('blogtudien.com','tudien.sangmentor.com') | Set-Content $_ }