Last active
May 7, 2024 00:48
-
-
Save hgirish/5188192014b9494900c23822f9adeac1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$files = Get-ChildItem "app*.config" -Recurse | |
$find = 'some-string-to-find' | |
$replace = 'some-string-to-replace-with' | |
Get-ChildItem $files -Recurse | | |
select -ExpandProperty fullname | | |
foreach { | |
If(Select-String -Path $_ -SimpleMatch $find -quiet){ | |
(Get-Content $_) | | |
ForEach-Object {$_ -replace $find, $replace } | | |
Set-Content $_ | |
write-host "File Changed : " $_ | |
} | |
} |
Same here, very useful peace of code, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that is great, save my 10 times time. Thank you HGIRISH!