PowerShell-将当前文件夹下所有代码合并到一个文本中

Get-ChildItem .\ -Recurse | ForEach-Object -Process {
    if ($_ -is [System.IO.FileInfo] -and $_.Name.EndsWith('.cs')) {
        $_.Name | Out-File -Append .\out.txt -Encoding UTF8
        Get-Content $_.FullName -Encoding UTF8 | Out-File -Append .\out.txt -Encoding UTF8
        "`n`n`n`n`n" | Out-File -Append .\out.txt -Encoding UTF8
    }
}
posted @ 2022-07-28 15:50  xYzDl  阅读(105)  评论(0)    收藏  举报