Edit the profile in Windows Terminal and change the command-line to be wsl ~
. Oddly, that particular argument to the wsl--cd C:\Users\%username%
command is still undocumented, but has been in place since, iirc, Windows 10 21H1.
Note that ~
must be the first argument if you do happen to have other arguments on the command-line.
It's also possible to use the The wsl --cd
argument. Originally this required a Windows path, but it will now can handle either Windows paths or Linux paths inside the WSL distribution:.
wsl --cd /home/<username>
UnlikeThe ~%username%
is the CMD variable for the username, since Windows still uses the old --cd
argument can come anywhere in the command(pre-linePowerShell) variable style when launching applications. For instance: You could, of course, hardcode it as well.
wsl -d Ubuntu-22.04 --cd /home/ntd
Keep in mind that file access under WSL2 is currently still much slower on Windows drives.