unicode findstr
카테고리 없음 / 2024. 2. 14. 14:47
$tempResults = 'filelist1.txt'
Set-Content -Path $tempResults -Value 'Path\Name.Extension, FileSize' -Encoding UTF8
foreach( $file in (Get-ChildItem -File -Path 'C:\path' -Recurse) )
{
$nameCount = Get-Content -Path $file.FullName -Encoding UTF8 | Select-String -Pattern 'userFindString' | Measure-Object | Select-Object -ExpandProperty Count
if( $nameCount -gt 0 )
{
$line = $file.DirectoryName + '\' + $file.BaseName + $file.Extension + ' ' + $file.Length + ' ' + $file.CreationTime
Add-Content -Path $tempResults -Value $line -Encoding UTF8
}
}
clear
type $tempResults
#notepad $tempResults
remove-item $tempResults