I've posted a function which should handle this https://www.hackerneue.com/item?id=41288792 and you can bind it to whatever key you like.
I remember vaguely having the same explorer-window issue as you mentioned, which is why I use both the Active Class and Active Exe of the current window.
Last one I used didn't work with File Explorer (since it is the same program as the Desktop), and I couldn't make it work, and it was more annoying than useful at the end.