VBS add right key to compute file MD5 implementation code

Source: Internet
Author: User
Tags hash md5 backup
Recently related backup more frequently, in order to verify the integrity of the file, always open a file hash check tool, more trouble, so wrote this dongdong, the file is a little slow to calculate, the file MD5 value saved on the Clipboard

Recent related backup more frequently, in order to verify the integrity of the file, always open a file hash check tool, more trouble, and wrote this dongdong, the file is a little slow to calculate, the file's MD5 value saved in the Clipboard! Effect as shown:

How to use:

1. Import the Getmd5.reg file into the registry first to add a right-click menu, Getmd5.reg the following code:

Copy Code code as follows:


Windows Registry Editor Version 5.00

[Hkey_classes_root*shellhash (&g) command]
@= ' WScript.exe//nologo c:windowssystem32getmd5.vbs '%1 ' '

2. Copy Getmd5.vbs to C:windowssystem32, complete all operations, Getmd5.vbs code as follows:

Copy Code code as follows:


Public Md5value


md5sum (wscript.arguments (0))


Setclipboardtext ("MD5:" & Md5value & ", FilePath:" & WScript.Arguments (0))


Function md5sum (filename)


Dim MyStream, myhashed, Md5value


Set MyStream = CreateObject ("ADODB. Stream ")


Mystream.type = 1


Mystream.open ()


mystream.loadfromfile (filename)


Set myhashed = CreateObject ("CAPICOM. Hasheddata ")


Myhashed.algorithm = 3


Myhashed.hash (Mystream.read ())


Mystream.close


Md5value = Myhashed.value


End Function

Sub Setclipboardtext (Text)
Dim Word
Set Word = CreateObject ("Word.Application")
Word.Documents.Add
Word.Selection.Text = Text
Word.Selection.Copy
Word.quit False
End Sub

If the script is running wrong, please download and register the CAPICOM component

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.