Yzöwl, on 24 January 2012 - 03:39 AM, said:
Some general observations:
You say you created the file some months ago, but strangely it was copyrighted only this month!
You say that you have used 'SHIFT' in order to allow for more than nine arguments, but 'SHIFT' appears to not exist within the code.
Your method of determining whether any arguments were input seems a little convoluted.
You didn't explain in enough detail what the purpose of the script was:
It compares one file which when dropped with a bunch of others onto a batch file is allocated as the first parameter, (using luck), with every other file following it. i.e. compare 1 with 2, 1 with 3, 1 with 4 etc.
Quote
It compares one file which when dropped with a bunch of others onto a batch file is allocated as the first parameter, (using luck), with every other file following it. i.e. compare 1 with 2, 1 with 3, 1 with 4 etc.
No that is unfortunately wrong, you can determine what param or arg %1 is by making sure that you want to compare with the file that you use to drag the collection of files with, is the one you want as %1. I've tested, and it's determined by the file itself that you drag over the batch, which gets parsed as the first argument after %0. For example: If you have 3 files, file1, file2 and file3. If you select all of them, and drag these files over the batch file itself by dragging file3 to move the files over the batch file to be used as arguments, file3 will become argument %1.
I updated the year in the batch file lol.

Batch files aren't compiled, so i'm freely able to edit that if I wish. Believe it or not, I created the script in 2011 but already had the year 2012 embedded in it anyways. It really plays no role on proof for when I created it though. For all you know I could have created this script more than a year ago (assuming the batch syntax would still be fitting for the NT version available to the user), but I still have optionality to change it to the year 9999 if I wanted lol.
My mistake though... I had a version which used SHIFT... I had it in my notepad :S but it seems I copied out this one instead. I would provide a link to where I have provided the version with, shift, but It may be against the rules, so how about I just copy the code that I have pasted on another forum here to show you the version using shift to move the input argument up by one?
Here's my first version:
@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 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
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.
I DID have a video of it in use, by the video got removed, because my Youtube account was deleted a week ago when I decided to try to delete my Google account which was linked with it. And unfortunately google deleted it along with the account.
My apologies though... I can't believe I missed that it didn't use shift. (the version of my script I posted)
If you have troubles reading it, or using the script, then just ask me though. First script is the most updated version as I found that shift was useless if I could just use the for loop to loop through all of the values in the arg list.
I know you're a good batch programmer, so no personal tension between you and me as a member, but I thought that someone may find this useful, or someone like yourself could help me improve it further.
If you don't feel like providing the advice that I so kindly looked for, even after clarifying what my idea of the kind of feedback that I wanted for this script was, then kindly do not post in this thread anymore. That's all. At least i've gotten some advice on how to check for a minimum number of input args without looping and counting each which makes my script a bit faster, but as well as a couple other little things posted by other members here.
Have a nice day
~Ace
This post has been edited by AceInfinity: 26 January 2012 - 07:52 PM