The code in Geany to spawn build commands on Windows is Windows specific. It uses `CreateProcessW` which says "If the file name does not contain an extension, .exe is appended." so it is assumed as `.exe` but by Windows, not Geany.
On the command line the shell probably does the checking for `.bat` and other stuff but there is no shell involved in build commands in Geany.