PowerShell 将输出导出到文本文件 | D栈 - Delft Stack

PHOTO EMBED

Fri Nov 25 2022 05:39:41 GMT+0000 (Coordinated Universal Time)

Saved by @leawoliu #powershell

Compare-Object $(Get-Content .\TestDoc1.txt) $(Get-Content .\TestDoc2.txt) | Out-File .\TestDoc3.txt
content_copyCOPY

在 PowerShell 中使用 Out-File 命令将普通命令的输出导出到一个文本文件中 Out-File 是将 PowerShell 命令的输出发送到文件的命令。例如,我们可以使用我们上面选择的命令,如下所示。

https://www.delftstack.com/zh/howto/powershell/powershell-export-to-text/