When I start WSL I cant add folders to path. I found out that this is because folders that are included in the windows PATH that has white spaces in their name break the linux $PATH. : For instance, when putting $PATH in the command line I am getting ....Some other folders...:/mnt/c/Program: no such file or directory.
If this was a manual process, I would use either "Program Files" of Program\ files but this is imported before ~/.bashrc kicks in so I dont know how to fix this.
Thank you for helping
Folders with spaces in their names should be enclosed with "", '', or escaped with backslash.
This is my path in .bashrc which I added in WSL to be able to use the code . to start up VSCode from WSL.
export PATH=$PATH:"/mnt/c/Users/Kamal/AppData/Local/Programs/Microsoft VS Code/bin"
After some more playing around "$PATH" did the trick.
I ran into the same problem when I created a second instance of Ubuntu 20.04 and set the default user through /etc/wsl.conf. Quoting $PATH in Line 6 ( export PATH=$PATH:${snap_bin_path} ) in /etc/profile.d/apps-bin-path.sh solved the problem for me.