@set three=3
@if trick%1==trick goto nomore
@set seo=%1
@if exist %seo% set seo=
@if trick%seo%==trick goto bitmore
@shift
:bitmore
@if exist %1 goto yesmore
@set three=%seo%
@set seo=%1
@shift
@if exist %1 goto yesmore
@goto nomore
:yesmore
@if trick%seo%==trick0 set seo=
@if exist mytemp.xxx erase mytemp.xxx
@if trick%2==trick @cbr%three% %seo% %1 | sort | find /V "usebackq " >> mytemp.xxx
@if trick%2==trick @goto pastbits
@if trick%3%4==trick/r/n @cbr%three% %seo% %1 %2 %4 | sort %3 | find /V "usebackq " >> mytemp.xxx
@if trick%4%3==trick/r/n @cbr%three% %seo% %1 %2 %3 | sort %4 | find /V "usebackq " >> mytemp.xxx
@if trick%3%4==trick/r @cbr%three% %seo% %1 %2 %4 | sort %3%4 | find /V "usebackq " >> mytemp.xxx
@if trick%3%4==trick/n @cbr%three% %seo% %1 %2 %3%4 | sort | find /V "usebackq " >> mytemp.xxx
@if trick%3%4==trick @cbr%three% %seo% %1 %2 | sort | find /V "usebackq " >> mytemp.xxx
:pastbits
@rbc mytemp.xxx %2
goto theend
:nomore
@echo One of first three parameters should have filename %1
:theend
