[#1626] On Windows find files with extensions before full path.


Problem description
===================

Some applications are distributed with both unix and windows commands.

For example for npm

* npm - is windows shell
* npm.bat is windows bat file


Why we got into this (5 whys)
=============================

* There was no test for this case.


Changes description
===================

Refactored the code and also updated some previous tests.


How to try and test the changes
===============================

reviewers @alibotean 

Check that everthing is ok.