REM = If the second parameter IS NOT an available hash method, it is used as REM = it is compared to the computed hash, and a success/fail message REM = If the second parameter matches an available hash method, it is used REM = and third are figured out contextually. REM = a hash to verify against the file and all available hashes are used. Set hashes=MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512 Setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION REM = If the second parameter IS NOT PROVIDED, all available hashes are REM = When done, a success/fail message is displayed. REM - IF NO HASH METHOD WAS PROVIDED, CHECK ALL HASHESĮcho Checking !file! against all hashes %hashes%.įor /f "tokens=*" %%g in ('certUtil -hashfile !file! %%f ^| findstr /v "hash"') do ( REM - CHECK IF PARAMETER 2 IS A HASH METHOD AND INITIALIZE REM - IF NO PARAMTERS PROVIDED OR FILE DOES NOT EXIST, DISPLAY USAGEĮcho If only the file is specified, all available hashes will be displayed.Įcho if FILE and HASH are specified, the hash will be compared to all availableĮcho hashes and a success/fail message will indicate if a match was found.Įcho This is like option 2 except that HASH is one of the available hashesĮcho and is validated against CHECK, if provided. ![]() REM - This check will not return anything if hashcheck = none. ![]() REM - Not required since this is the end of the script, but there REM - If a hash method is supplied, this is used.Įcho Checking !file! against hash method !hashmethod!.įor /f "tokens=*" %%g in ('certUtil -hashfile !file! !hashmethod! ^| findstr /v "hash"') do ( REM - The success and failure messages are only displayed if hashcheck != none.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |