(编辑:jimmy 日期: 2024/12/23 浏览:2)
使用方法:
1.先将GetMD5.reg文件导入注册表以添加右键菜单,GetMD5.reg代码如下:
复制代码 代码如下:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\HASH(&G)\command]
@="WScript.exe //nologo c:\\windows\\system32\\GetMD5.vbs \"%1\""
2.复制GetMD5.vbs到c:\windows\system32\,即完成所有操作,GetMD5.vbs代码如下:
复制代码 代码如下:
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
脚本如运行出错,请下载并注册CAPICOM组件