I have WSL (Windows Subsystem for Linux) set up on my computer with Ubuntu.
When I want a Linux session, I hit Win+R
and type bash
because it's short and quick.
However, it always drops me into /mnt/c/Users/Michael
.
I want it to drop me into my Ubuntu home directory (~
) instead.
I've tried adding cd ~
to my .bash_profile, but then whenever I try to run bash
from the command line, it always takes me to ~
, instead of opening bash in the current directory.
I can get around this by running ubuntu
from the Run Dialog, but it takes longer and is harder to spell.
How can I get bash
to open ~
when run from the run dialog, and the current working directory when run from Command Prompt or PowerShell? Or, what are some good workarounds?
sh -c 'cd ~/Documents; exec "${SHELL:-sh}"'
(you may want to substitutesh
withbash
and deleteDocuments
too since you want only~
)... But I hope you get the hint.bash
from the command line.wsl.bat
orrunbash.bat
) containing thesh -c '…'
command, and then run that from the Run dialog, while continuing to usebash
from Command Prompt or PowerShell. Or create a Windows shortcut, and put that in your Start menu or on your desktop.