Powershell Speed: How to speed up ForEach-Object MD5/hash check
问题 I'm running the following MD5 check on 500 million files to check for duplicates. The scripts taking forever to run and I was wondering how to speed it up. How could I speed it up? Could I use a try catch loop instead of contains to throw an error when the hash already exists instead? What would you all recommend? $folder = Read-Host -Prompt 'Enter a folder path' $hash = @{} $lineCheck = 0 Get-ChildItem $folder -Recurse | where {! $_.PSIsContainer} | ForEach-Object { $lineCheck++ Write-Host