2

I have a windows subsystem for Linux Installed on my computer and am using it as the integrated terminal on Visual Studio Code. Every time I open a terminal however, it opens in the root directory rather than the current project directory like other terminals do.

Does anyone know of a fix for this?

I have tried messing with the Cwd of the integrated terminal settings but haven't had any luck.

2 Answers 2

2

Try using wsl.exe as the command for shell.

"terminal.integrated.shell.windows": "wsl.exe"
Sign up to request clarification or add additional context in comments.

Comments

-1

I know that is very late for this answer, but for me it just worked. I put exactly as above and it launched in my home directory (that is /mnt/d/Users/Adrian).

I have the user setup of VSC, 1.30.1 and launch it from the Desktop shortcut. After I configured terminal as wsl I go as below: If I open a cmd windows I can launch it with code . it will launch in Windows home directory. If move to some other folder (e.g Documents) and launch it with code . the bash will launch to that folder. Otherwise I can launch it with code D:\Users\Adrian\Documents\VSC and the bash terminal will launch in \mnt\D\Users\Adrian\Documents\VSC

Tested the change both via menu File->Preferences->Settings and with Ctrl+Shift+P (Command Pallete), Terminal: Default Shell.

Tried with bash and wsl.

Maybe you have some other bash installed in the path? (e.g. git bash or MinGW bash?)

1 Comment

Yeah, I finally got it working too after reinstalling VS Code. I ran into more trouble trying to get it to work with my React Native projects so gave up with the whole idea though. Thanks Adrian

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.