批处理--md5校检

@echo off

rem 获取文件xx.zip的MD5

for /f "delims=" %%i in ('md5.exe xx.zip') do (set md5_var=%%i)

echo %md5_var%



::从文件获取MD5 格式MD5=xxxxxxxxxxxxxx

::tokens表示demlims后第一个符号分割的列号

for /f "tokens=2 delims==" %%i in (1.txt) do (

echo %%i|findstr "="



set md5_provide=%%i)

echo %md5_provide%



if "%md5_var%" == "%md5_provide%" (

    echo success

) else (

    echo error %md5_var%

)

pause > nul

 

你可能感兴趣的:(MD5)