@echo off
chcp 65001 >nul
set "file1=C:\Users\d.zabrodin\Documents\work3\gradi.txt"
set "file2=C:\Users\d.zabrodin\Documents\work3\gradi2.txt"
powershell -NoProfile -Command ^
"$f1 = [System.IO.File]::ReadAllBytes('%file1%');" ^
"$f2 = [System.IO.File]::ReadAllBytes('%file2%');" ^
"$len = [Math]::Max($f1.Length, $f2.Length);" ^
"$min = [Math]::Min($f1.Length, $f2.Length);" ^
"$match = 0;" ^
"for ($i = 0; $i -lt $min; $i++) { if ($f1[$i] -eq $f2[$i]) { $match++ } };" ^
"$pct = if ($len -eq 0) { 100 } else { [Math]::Round(($match / $len) * 100, 2) };" ^
"Write-Host ('Целостность: ' + $pct + '%%')"
pause