How do I concatenate two text files in PowerShell?

前端 未结 11 1952
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 03:17

I am trying to replicate the functionality of the cat command in Unix.

I would like to avoid solutions where I explicitly read both files into variables

11条回答
  •  执念已碎
    2020-11-28 03:51

    If you need to order the files by specific parameter (e.g. date time):

    gci *.log | sort LastWriteTime | % {$(Get-Content $_)} | Set-Content result.log
    

提交回复
热议问题