Loading [MathJax]/jax/element/mml/optable/BasicLatin.js

2014年12月9日火曜日

[Windows Powershell] フォルダ内のファイルに対して文字列の一括置換をかける方法

とりあえずメモだけ。

Get-ChildItem -Path . | Select-Object 'Name' | ForEach-Object -Process {f = (Get-Content -Path _.Name) -replace "置換前","置換後"; f > $_.Name} 

上のやり方だと、ファイルの中身を全部メモリに持っちゃうので、数百MBとかGB単位のファイルがあると厳しいかも。