5

I am wondering how to change the starting directory of my windows terminal from /home/user/ to C:/Users/user. I tried a few things I found, but nothings works. This is my current profile specified in the settings.json file:

{
  "acrylicOpacity" : 1,
  "closeOnExit" : true,
  "colorScheme" : "One Half Dark",
  "commandline" : "ubuntu",
  "cursorColor" : "#FFFFFF",
  "cursorShape" : "bar",
  "fontFace" : "Consolas",
  "fontSize" : 10,
  "guid" : "{ba50f801-2d96-4517-a737-575f32f0fb61}",
  "historySize" : 9001,
  "icon" : "C:/Users/user/Pictures/ubuntu.png",
  "name" : "Ubuntu",
  "padding" : "0, 0, 0, 0",
  "snapOnInput" : true,
  "startingDirectory" : "C:\\Users\\user",
  "useAcrylic" : true
}

but when I open the terminal the prompt is user@laptop:~$ and pwd gives /home/user/

4 Answers4

10

If you mean wsl, you can set startingDirectory just like this:

"startingDirectory": "//wsl$/Ubuntu/home/user"

You can explore the path \\wsl$ in Windows Explorer.

alexzshl
  • 516
  • 1
  • 5
  • Works for most cases, but not for `//wsl$/Ubuntu/mnt/c` - it seems that `mnt/c` is only resolved after the `startingDirectory` is set. Oscar's answer below provided the fix in this case. – c z Mar 17 '21 at 09:27
  • This `//wsl$/Ubuntu/home/username` is the only one that works for me in WT Preview 1.8, simply input the text in the _Settings > Profiles > Ubuntu > Starting directory_ and click the _Save_ button. – kiatng May 23 '21 at 05:30
4

This works for me (on Windows Terminal 1.0.1401.0, WSL2 and Ubuntu 20.04):

"startingDirectory": "C:/Users/user"
Oscar Siauw
  • 403
  • 2
  • 8
0

for me it worked when i added the version number: //wsl$/Ubuntu-20.04/home/username

mischkez
  • 81
  • 4
-1

The issue was that there was an auto-generated ubuntu profile in addition to the one I created. I started using the auto-generated one and removed the "commandline" : "ubuntu" option and it now listens to the startingDirectory