|Well, here the streamlined batch that fits your PS question. Notice that 2^>nul may be omitted since I had to set it to workaround a bug under my system.|
You can see I avoid to use GOTO statements: as far as you can follow the rules of structured programming in batch scripting to work out neater code.
I suggest you take a look at the on-line short tutorial related to commands by typing at prompt the /? switch after the opcode (e.g. set /?). Do this even for commands you believe to know fine as surprises may blow up.
I strongly raccomand you type SET /? to read about the "Delayed Expansion" of environment variables that affects FOR loops and any sequence of commands embraced by left and right parenthesis.
So you can achieve a full and safe control of "atomic power" avoiding common pittfalls
for /F "tokens=1,2" %%i in ('tasklist 2^>nul ^| find "%searchName%"') do (