Skip to main content
Post Undeleted by NotTheDr01ds
Err, fixed misreading
Source Link
NotTheDr01ds
  • 23.6k
  • 6
  • 70
  • 112

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.

Edit the profile in Windows Terminal and change the command-line to be wsl ~. Oddly, that particular argument to the wsl 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 wsl --cd argument. Originally this required a Windows path, but it will now handle paths inside the WSL distribution:

wsl --cd /home/<username>

Unlike ~, the --cd argument can come anywhere in the command-line. For instance:

wsl -d Ubuntu-22.04 --cd /home/ntd

Edit the profile in Windows Terminal and change the command-line to be wsl --cd C:\Users\%username%. The --cd argument can handle either Windows paths or Linux paths inside the WSL distribution.

The %username% is the CMD variable for the username, since Windows still uses the old (pre-PowerShell) variable style when launching applications. You could, of course, hardcode it as well.

Keep in mind that file access under WSL2 is currently still much slower on Windows drives.

Post Deleted by NotTheDr01ds
added 344 characters in body
Source Link
NotTheDr01ds
  • 23.6k
  • 6
  • 70
  • 112

Edit the profile in Windows Terminal and change the command-line to be wsl ~. Oddly, that particular argument to the wsl command is still undocumented, but has been in place since, iirc (on mobile at the moment), 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 wsl --cd argument. Originally this required a Windows path, but it will now handle paths inside the WSL distribution:

wsl --cd /home/<username>

Unlike ~, the --cd argument can come anywhere in the command-line. For instance:

wsl -d Ubuntu-22.04 --cd /home/ntd

Edit the profile in Windows Terminal and change the command-line to be wsl ~. Oddly, that particular argument to the wsl command is still undocumented, iirc (on mobile at the moment).

Note that ~ must be the first argument if you do happen to have other arguments on the command-line.

Edit the profile in Windows Terminal and change the command-line to be wsl ~. Oddly, that particular argument to the wsl 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 wsl --cd argument. Originally this required a Windows path, but it will now handle paths inside the WSL distribution:

wsl --cd /home/<username>

Unlike ~, the --cd argument can come anywhere in the command-line. For instance:

wsl -d Ubuntu-22.04 --cd /home/ntd
Source Link
NotTheDr01ds
  • 23.6k
  • 6
  • 70
  • 112

Edit the profile in Windows Terminal and change the command-line to be wsl ~. Oddly, that particular argument to the wsl command is still undocumented, iirc (on mobile at the moment).

Note that ~ must be the first argument if you do happen to have other arguments on the command-line.