I created the exact batch code (with a pause at the end) and it worked
as I expected it would. I also created a file named 'taskkill' without
extension in the same folder as the batch and it still worked.
Since renaming the batch worked for the OP, I would suggest asking OPs
post their PATHEXT list each time this comes up to verify the order of
precedence on the system in question is unmodified. Mine is as follows
and I do not recall modifying it.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
NOTE: I am not advocating giving batch files the same name as known
system commands. I am more interested in why it fails for some people
but works for others. In this case, the OP asked "What happened first
time? And why it is executing second time?" which suggests there is some
difference between dbl-clicking in explorer and typing it at the command
prompt.