实现当前目录下所有文件的MD5和SHA2数值
@echo setlocal enabledelayedexpansion确保for循环中可以输出变量
@setlocal enabledelayedexpansion
@echo off
for /r %%i in (*) do (
certutil -hashfile %%i MD5 | findstr /v /I "cer | md5" > %%i.txt
certutil -hashfile %%i SHA1 | findstr /v /I "cer | SHA1" >> %%i.txt
(set /p md5sum=&set /psha1sum=)<%%i.txt
@echo 取消MD5中的空格
set "md5sum=MD5: !md5sum: =!"
@echo 取消SHA2中的空格
set "sha1sum=SHA2: !sha1sum: =!"
echo !md5sum!
echo !sha1sum!
echo !md5sum!>%%i.txt
echo !sha1sum!>>%%i.txt
)
pause