Provide a default `PATHEXT` environment variable.

Added test case which relies on the `PATHEXT` environment variable.
Merge pull request #8139 from s0undt3ch/features/mocked-which-test

Provide a default `PATHEXT` environment variable.