Skip to content

Instantly share code, notes, and snippets.

@eschen42
Created February 18, 2020 13:24
Show Gist options
  • Select an option

  • Save eschen42/3b961152ca5d220a91c1d6cdb0a31ae5 to your computer and use it in GitHub Desktop.

Select an option

Save eschen42/3b961152ca5d220a91c1d6cdb0a31ae5 to your computer and use it in GitHub Desktop.
powershell commandlet based MD5 hashing - much slower than FCIV
setlocal
set DASH_R=TRUE
set BASE_PATH=%CD%\
set BASE_PATH=%BASE_PATH::=.%
set BASE_PATH=%BASE_PATH:\=.%
if %DASH_R% == FALSE powershell -Command "Get-FileHash -Algorithm MD5 -Path %1\* | Sort-Object Path | Select-Object -Property Hash,Path | Out-String -Stream" | sed -e "/^Hash/d; /^---/d; /^$/d; s/%BASE_PATH%//"
if %DASH_R% == TRUE for /f "delims=" %%D in ('dir/on/s/ad-h/b %1 ^| grep -v "[\][.]"') do @powershell -Command "Get-FileHash -Algorithm MD5 -Path '%%D\*' | Sort-Object Path | Select-Object -Property Hash,Path | Out-String -Stream" | sed -e "/^Hash/d; /^---/d; /^$/d; s/%BASE_PATH%//"
endlocal
@eschen42
Copy link
Author

Microsoft FCIV is very fast and very old. This was my attempt at a slightly more modern implementation, but the performance is ridiculously slower than FCIV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment