How to add a right-click calculation file MD5 using VBS
This article mainly introduces how to use VBS to add right-click calculation file MD5, the article is very detailed, has a certain reference value, interested friends must read it!
Recently, related backups are more frequent, in order to verify the integrity of files, always have to open a file HASH verification tool, more troublesome, so write this thing, the file is a bit slow to calculate when the file is large, the MD5 value of the file is saved in the clipboard! The effect is as shown in the figure:
How to use it:
1. First import the GetMD5.reg file into the registry to add the right-click menu, the GetMD5.reg code is as follows:
The copy code is as follows:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ *\ shell\ HASH (& G)\ command]
@ = "WScript.exe / / nologo c:\\ windows\\ system32\\ GetMD5.vbs\"% 1\ "
two。 Copy GetMD5.vbs to c:\ windows\ system32\, which completes all operations. The GetMD5.vbs code is as follows:
The copy code is 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
The above is all the contents of the article "how to add a right-click calculation file MD5 using VBS". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!