if exist errorlog105697.txt set errorcode=1
dir /s errorlog105697.txt > List.txt
find /n "errorlog105697.txt" List.txt > LineNums.txt
I'm not that familiar with the SET parsing commands, but here's what you need to do:
If the number of records in LineNums.txt is > 3 then set errorcode = 2
LineNums.txt contains all the line numbers where the string "errorlog105697.txt" is found in List.txt. Subtract 2 from each of these line numbers to get the line numbers that contain the directory(s) where errorlog105697.txt can be found. Extract the path information from List.txt into environment variable "MyPath". Then:
You'll have to decide what to do if it is both in the current directory and someplace else.