ファイルの連結について、いい記事があります。 あるファイルを別のファイルに連結させる 私が書くコードでは Set-Content/Add-Content を使わないです。が、なぜなのかを振り返るのもいいでしょう。 今回は、 Set-Content/Add-Content と Out-File/Out-File -Append の違いについてです。 tl;dr; 上書きと追記 書き込み方法の違い と NoClobber による上書き防止 上書き 上書き防止 Out-File -NoClobber -Force の併用 追記 Out-File -NoClobber -Append の併用 Write/Read ロック Out-File Set-Content / Add-Content デフォルトEncoding の違い InputObjectが空の場合のファイル作成挙動 PassThru の
![PowerShellの Out-File と Set-Content あるいは Out-File -Append と Add-Content の違い - tech.guitarrapc.cóm](https://cdn-ak-scissors.b.st-hatena.com/image/square/9c48e7ed7bb9d14f52810c19f80ab39e38ea75df/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fg%2Fguitarrapc_tech%2F20140211%2F20140211051312.png)