mirror of
https://github.com/serialexperiments0815/PowershellExcercises.git
synced 2026-07-12 15:32:25 +00:00
8 lines
No EOL
306 B
PowerShell
8 lines
No EOL
306 B
PowerShell
# File searches for txt files and replaces specified string.
|
|
|
|
$textFiles = Get-ChildItem -Path "./" -Filter *.txt
|
|
$searchText = 'this text is false'
|
|
$replaceText = 'this text is true'
|
|
foreach($textFile in $textFiles){
|
|
(Get-Content $textFile) -replace $searchText, $replaceText | Set-Content $textFile
|
|
} |