https://www.pstips.net/question/7744.html
# 先保存一份清单 dir C:\Windows\System32\drivers\etc\ -File -Recurse | Get-FileHash -Algorithm MD5 | ConvertTo-Json | Out-File hash-list.json # 读取保存的值 $old = Get-Content .\hash-list.json | ConvertFrom-Json #获取最新值 $new = dir C:\Windows\System32\drivers\etc\ -File -Recurse | Get-FileHash -Algorithm MD5 #进行比较 Compare-Object $new $old
缺点文件夹带空格 ,失败
https://www.cnblogs.com/bio-mary/p/12131684.html
title md5批量生成脚本-by miles setlocal enabledelayedexpansion %~d0 cd %~dp0 if exist 1234.txt del 1234.txt for /R %%s in (.,*) do ( echo %%s ) >>1234.txt if exist md5.txt del md5.txt for /f "skip=1" %%a in (1234.txt) do certutil -hashfile %%a MD5>>md5.txt
然后学习了下修改如下 可以带空格目录名了
https://www.cnblogs.com/Jian-Zhang/p/6066429.html
title md5批量生成脚本-by miles setlocal enabledelayedexpansion %~d0 cd %~dp0 if exist 1234.txt del 1234.txt for /R %%s in (.,*) do ( echo "%%s" ) >>1234.txt if exist md5.txt del md5.txt for /f "skip=1 tokens=*" %%a in (1234.txt) do certutil -hashfile %%a MD5>>md5.txt