windows 批量生成目录下 文件MD5

时间:2021-09-23 07:39:18   收藏:0   阅读:57

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

原文:https://www.cnblogs.com/marklove/p/15310134.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!