本帖最后由 h503mc 于 2019-8-28 17:46 编辑
一种:- @echo off
- ::xxxx
- ::xxxx
- call:filemd5 %0
- set get=%hash% %=get为文件hash=%
- call:textmd5 xxxxx
- set get=%hash% %=get为文字hash=%
-
- :textmd5
- echo %1 >mdt.tmp
- certutil -hashfile mdt.tmp MD5|find /v ":" >md5.tmp
- set /p hash=<md5.tmp
- set hash=%hash: =%
- del md5.tmp
- del mdt.tmp
- :filemd5
- certutil -hashfile %1 MD5|find /v ":" >>md5.tmp
- set /p hash=<md5.tmp
- set hash=%hash: =%
- del md5.tmp
- goto:eof
复制代码 另一种- @echo off
- ::xxxx
- ::xxxx
- certutil -hashfile %0 MD5|find /v ":" >>md5.tmp
- set /p hash=<md5.tmp
- set hash=%hash: =%
- del md5.tmp
- ::hash结果就是变量%hash%
复制代码
|