使用 Windows 7、10 內建hash工具 certuti 搭配-hashfile 產生並顯示檔案上的密碼編譯雜湊
可使用的雜湊演算法:MD2/MD4/MD5/SHA1/SHA256/SHA384/SHA512
@echo off
echo Program is running...
set today=%date:~0,10%
set nowHr=%time:~0,2%
rem 若時小於10,前面補0 例: 9→09, 8→08
if %nowHr% LSS 10 set nowHr=%nowHr: =0%
set nowMin=%time:~3,2%
set nowSec=%time:~6,2%
forfiles /p C:\folderName /s /m *.* /c "cmd /c certUtil -hashfile @file MD5 >> C:\folderName\%today:/=%%nowHr%%nowMin%%nowSec%_file_md5.txt"
pause
exit
資料參考來源:
※https://learn.microsoft.com/zh-tw/windows-server/administration/windows-commands/certutil
※https://blog.darkthread.net/blog/compute-file-hash-in-win/
※https://onthefencedevelopment.com/2017/08/15/windows-10-builtin-md5-checksum-calculator
※https://ithelp.ithome.com.tw/articles/10240079