I am trying to change(using Power Shell) errors in 20 to 50 *.ini files and
the logic for the loop escapes me.
Thank you in advance,
--
Dan O
From the location of where the .ini files are, type in the following:
(Note: the 'for' loop is one long line, just cut/copy and paste into the PS
prompt)
$filename = Get-ChildItem -name *.ini
$i = 0
for ($i = 0; $i -le ($filename.length - 1); $i++) {
(Get-Content $filename[$i]) | ForEach-Object {$_ -replace "[old text]",
"[new text]"} | Set-Content $filename[$i]
}
It doesn't output any text but the functionality of it should do exactly
what you are looking for. Just be sure to replace [old text] & [new text]
with your text.
Enjoy!
- Alex