Sample Header Ad - 728x90

Windows PATH sometimes not loaded into wsl PATH

0 votes
2 answers
645 views
I'm using Arch linux in WSL ([yuk7/archWSL](https://github.com/yuk7/archWSL)) . Info pasted at the bottom of this question. Most of the time, I can run Windows programs from a WSL shell with no problems. Take, for example, explorer.exe ., which will open up Windows Explorer to the current working directory. Sometimes, however, Windows' binaries' folders aren't loaded into my PATH. I've concluded this as when working as expected, which explorer.exe outputs the path to explorer, and echo $PATH contains /mnt/c/Windows; however, when calling explorer.exe shows -bash: explorer.exe: command not found, my PATH is much shorter and does not contain any of the Windows directories I would expect it to. To fix this, I can either add the location of the executable I want into PATH manually when I encounter the issue (which requires me to memorise the location of each one), or terminate my WSL instance and start it anew, which usually fixes the issue. Starting a new shell or sourcing ~/.bashrc and similar have proven ineffective solutions. I'm looking for the reason that my Windows PATH is sometimes not included in my WSL PATH, and a way to ensure that it is included. WSL info pasted below.
WSL version: 2.3.26.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4460
Asked by Josh Brunton (146 rep)
Nov 18, 2024, 04:29 PM
Last activity: Apr 11, 2025, 02:21 PM