Get checksum (MD5) of any file using "certutil"/cmd

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1120
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Get checksum (MD5) of any file using "certutil"/cmd

Post by Grovkillen » Wed Jun 07, 2023 11:22 am

Code: Select all

Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Let>PATH_TO_FILE=path to your file <-----------------------------
Let>CMD_TO_RUN=cmd /c c: & certutil -hashfile "%PATH_TO_FILE%" MD5 | clip
RunProgram>CMD_TO_RUN
GetClipBoard>HASH_OF_FILE,0
Let>CLEANUP_REGEX=[\S\s]*([a-f0-9]{32})[\S\s]*
RegEx>CLEANUP_REGEX,HASH_OF_FILE,0,,,1,$1,HASH_OF_FILE
MDL>HASH_OF_FILE
15.0.23 and later:

Code: Select all

Let>RP_WINDOWMODE=0
Let>RP_CAPTURESTDOUT=1
Let>PATH_TO_FILE=path to your file <-----------------------------
Let>CMD_TO_RUN=certutil -hashfile "%PATH_TO_FILE%" MD5
RunProgram>CMD_TO_RUN
Let>CLEANUP_REGEX=[\S\s]*([a-f0-9]{32})[\S\s]*
RegEx>CLEANUP_REGEX,RP_STDOUT,0,,,1,$1,HASH_OF_FILE
MDL>HASH_OF_FILE
Short:

Code: Select all

Let>RP_WINDOWMODE=0
Let>RP_CAPTURESTDOUT=1
Let>PATH_TO_FILE=path to your file <-----------------------------
RunProgram>certutil -hashfile "%PATH_TO_FILE%" MD5
RegEx>[\S\s]*([a-f0-9]{32})[\S\s]*,RP_STDOUT,0,,,1,$1,HASH_OF_FILE
MDL>HASH_OF_FILE
Let>ME=%Script%

Running: 15.0.27
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts