0

我有以下代码工作-基于stackoverflow上的巨大帮助-解析CSV文件。我想替换 $_.File - 与包含文件列表的第二个 CSV 文件中的数据匹配。

Import-csv "D:\NTFSInfo_C_.csv" -header("File","ParentName","Extension","Attributes","SizeInBytes","CreationDate","LastModificationDate","LastAccessDate","LastAttrChangeDate","Status","USN","FRN","ParentFRN","FileNameCreationDate","FileNameLastModificationDate","FileNameLastAccessDate","FileNameLastAttrModificationDate")|
  Where-Object{($_.File -match "null.sys") -or ($_.File -match "explorer.exe")} |
  Select-Object File, CreationDate, FileNameCreationDate, ParentName |
  Export-CSV -Path c:\NTFS_KNOW_IOC.csv -NoTypeInformation

问题。如何将 TXT 或 CSV 中的文件名列表读取到数组中,然后在 Where-Object 中使用该数组,如上所示?

谢谢!

4

1 回答 1

2
$files = Get-Content files.txt
...

Where-Object{($files -match "null.sys") -or ($files -match "explorer.exe")} ...
于 2012-06-18T21:06:54.520 回答