gpt4 book ai didi

powershell - Powershell脚本将目录中文件的内容发送到写入输出

转载 作者:行者123 更新时间:2023-12-03 00:41:49 32 4
gpt4 key购买 nike

我有一个包含以下文件的文件夹:

C:\temp\installer_logs\main.log
C:\temp\installer_logs\component1.log
C:\temp\installer_logs\component2.log

我需要一个Powershell脚本,该脚本获取C:\ temp \ installer_logs中所有文件的列表,并将每个文件的内容发送到Write-Output。以下无效。救命?
dir -Recurse C:\temp\installer_logs | Get-ChildItem | Select FullName | Write-Output

最佳答案

您只需要那里的Get-Content即可实际读取内容并将其传递给Write-Output

Get-ChildItem C:\temp\installer_logs | Get-Content | Write-Output

关于powershell - Powershell脚本将目录中文件的内容发送到写入输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60103110/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com