- 文字を置換する
Get-ChildItem $target|%{ if($_.GetType().Name -eq "FileInfo"){ (Get-Content $_.FullName)|%{ $_ -replace "探す文字列","置き換える文字列" }|Set-Content $_.FullName } }
- 1行目をスキップしたファイルに更新する
Get-ChildItem $target|%{ if($_.GetType().Name -eq "FileInfo"){ (Get-Content $_.FullName|select -Skip 1)|Set-Content $_.FullName } }
- 行数を数える
Get-ChildItem $target|%{ if($_.GetType().Name -eq "FileInfo"){ "{0},{1}" -f (Get-Content -Path $_.fullname).Length, $_.Name } }