How can I calculate checksum and verify against a register with a batch file? I'm trying to use a redirect/pipe inspired by https://stackoverflow.com/a/42706309/4539999 (best called from a batch file) and looking for something simpler than https://stackoverflow.com/a/42172138/4539999.
Many Views with No Answers to this Ascynchronous Thread Issue
...Each side of a pipe starts its own cmd.exe in its own ascynchronous thread...
Described here: Why does delayed expansion fail when inside a piped block of code? Best Checksum solution from @dbenham at https://stackoverflow.com/a/42172138/4539999
===== Back to the attempt:
CertUtil -hashfile "path_to_file" MD5 | find /i /v "md5" | find /i /v "certutil"
How is the output from the first command used as the find string in the second command? For example using NestBat.bat:
C:\Users\User\Code\NestBat>certutil -hashfile NestBat.bat MD5 | find /i /v "md5" | find /i /v "certutil"
c19c099a7703768ef1b8dbeec3c45dba
C:\Users\User\Code\NestBat>find "c19c099a7703768ef1b8dbeec3c45dba" Manifest.MD5
---------- MANIFEST.MD5
c19c099a7703768ef1b8dbeec3c45dba NestBat.bat
Something like:
@echo off
:: ValidateHashcode.bat
setlocal enabledelayedexpansion
CertUtil -hashfile "%1" MD5 | find /i /v "md5" | find /i /v "certutil" ^> %temp%\Hashcode.tmp
set Hashcode=^<%temp%\Hashcode.tmp
del %temp%\Hashcode.tmp
find "%Hashcode%" Manifest.MD5
if NOT "%ERRORLEVEL%"=="0" echo *** Process Error ****
set Hashcode=
endlocal
(But it is never going to work - check the references above.)