$files = Get-ChildItem -path C:\DATA\Files -filter *.txt foreach ($file in $files) { $content = Get-Content $file if ($content -match "99999999") { $content = $content -replace "99999999", $file.BaseName Set-Content $file $content } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)