When I run the 'bash' command in the terminal, my console automatically switches to the 'wsl' mode. Why is this happening and how do I stop this behavior? It causes problems when I run other scripts, that use bash internally, because it tries to run the bash from the WSL and I don't want that. When I try to disable wsl on my machine and then run bash, it results in an error saying WSL is not enabled on this machine. enter image description here
1 Answer
bash is not part of Windows itself. It comes as part of WSL. (Or CygWin, or several other products that provide a bash shell.)
When you you attempt to run any command (no matter whether it is bash or anything else) in PowerShell (or any other shell for that matter) PowerShell will look for the first available copy of the requested program it can find in the locations specified in the PATH environment and, in your case, the WSL version is the first thing it finds and which will be executed.
If you have another bash on your system that you prefer to use you will have to make sure that its location appears in PATH before the WSL version.