See the command search sequence on Microsoft Docs
The PATH and PATHEXT environmental variables each provide an element of the search sequence: PATH is the ordered list of directories “where” to look, and PATHEXT is the ordered list of file extensions (“what“) to look for (in case the extension isn’t explicitly provided on the command line). Prior to using the PATH however, the current directory is searched.
The PATHEXT variable defaults to “.COM;.EXE;.BAT;.CMD”