powershell

powershell -NoProfile -ExecutionPolicy Unrestricted .\hogehoge.ps1
powershell -NoProfile -ExecutionPolicy Unrestricted .\hogehoge.ps1



検索

$utf8 = New-Object System.Text.UTF8Encoding($False) #BOMなしUTF-8
$result = Select-String "FATAL|ERROR" *.log -Encoding default # 検索結果を取得
[System.IO.File]::WriteAllLines("result.txt", ($result | % { $_.get_line() }), $utf8) # 出力