This is part XXVII of cmd engine rewrite.
It covers: - fixing a regression introduced when looping up for program names with several dots in their names (eg. foo.bat can invoke foo.bat.cmd) - fix an incorrect handling of 'SET =' command - a couple of cleanups in SET command