I'm using this method to have .sh files in Windows Explorer execute using bash.exe:
"C:\Windows\System32\bash.exe" -c " \"./$(grep -oE '[^\\]+$' <<< '%L')\"; cd ~; bash;"
This works fine for files outside of my WSL2 linux distro, however for files such as
\\wsl$\Ubuntu\home\davidg\example.sh I get
From powershell I can run
bash.exe ./example.sh from the working directory and it executes no problem.
Why is this happening and how can I resolve it?
Workaround is to run
pushd \\wsl$\Ubuntu from
cmd.exe and execute the .sh files from the mapped drive in Windows Explorer instead of the UNC path.