01-06-2012, 08:05 AM
Here's another batch script I just created a few minutes ago. This will use fc to compare files by their binary data with the /b flag that i've specified directly in the code. After comparing each file to the first argument as the original file in which all other arguments/parameters as files will be compared to, it creates an output text file as a log to return all of the results. If you have lots of files to compare, the buffer of the console window probably won't let you view all of the data, so it's exported to a text file instead. It may have been better to change the code to make an export of each comparison test to a new file so that the text file doesn't become too large, however I don't think anyone will be doing that, it will most likely be maybe 1-5 files.
If you want it to export to a new file everytime i'll create a new revised script if anyone wants it that way.
Important Note: The way parameters are defined, it basically uses the NTFS filesystem default from top to bottom I believe in the order that it places values into arguments that are sent (to my script in this case). Therefore you can't really choose which file goes where if you use the drag drop method, unless you open a command prompt and define each filepath manually. But that doesn't really matter as we know that if you select more than one file, WHILE DRAGGING THE GROUP OF FILES OVER MY BATCH SCRIPT THE ONE FILE THAT YOU USED TO DRAG THE GROUP OF SELECTED FILES IS PARSED AS THE FIRST ARGUMENT (%1)
This may be handy for you to know, when you want to quickly compare all other selected files to a specific file of your choice.
Enjoy
Don't copy and paste my script elsewhere without my permission, and give credits if you ask for my permission and you have posted this somewhere else.
If you want it to export to a new file everytime i'll create a new revised script if anyone wants it that way.
Important Note: The way parameters are defined, it basically uses the NTFS filesystem default from top to bottom I believe in the order that it places values into arguments that are sent (to my script in this case). Therefore you can't really choose which file goes where if you use the drag drop method, unless you open a command prompt and define each filepath manually. But that doesn't really matter as we know that if you select more than one file, WHILE DRAGGING THE GROUP OF FILES OVER MY BATCH SCRIPT THE ONE FILE THAT YOU USED TO DRAG THE GROUP OF SELECTED FILES IS PARSED AS THE FIRST ARGUMENT (%1)
This may be handy for you to know, when you want to quickly compare all other selected files to a specific file of your choice.
Code:
@echo off
title Binary File Compare - Created by AceInfinity
set i=0
set args=0 && for %%a in (%*) do set /a args+=1 && set "original=%1"
if %args% lss 2 call :noArgs
set /a args-=2
if not exist "bin_output" md "bin_output"
(
echo.----------------------------------------------------------------
echo. Binary File Comparison Script - Created by AceInfinity
echo. Copyright Tech.Reboot.Pro 2012
echo.----------------------------------------------------------------
echo.
) > "bin_output\results.txt"
echo Processing Binary Data...
:start
fc /b %original% %2 >> "bin_output\results.txt"
shift
set /a i+=1
if not %i% gtr %args% goto start
exit
:noArgs
echo No other input files as arguments could be found...
echo Please specify at least 2 input files to be used for comparison
echo. && pause
exit
Enjoy
Don't copy and paste my script elsewhere without my permission, and give credits if you ask for my permission and you have posted this somewhere else.