Skip to content
Advertisement

Windows sublinux – get windows path where linux was called

is it possible to get the directory path from Windows where for example “debian” was executed?

For example I open my projects with Visual Code and execute the NodsJs/npm projects from Windows WSL Debian. So it would be nice if “debian” is called from inside the Visual Code console that my linux subsystem auomatically joins the Windows directory from where I am coming. Yes I am already using symlinks but then I have to create a symlink for each project. An automatically solution would be much more comfortable.

I googled and haven’t found something regarding this. Would be great if someone can tell me if this is possible or not.

Advertisement

Answer

I was not sure what you meant but apparently there’s a debian.exe that lands in the users home dir.

You can just use the wsl.exe to get the behavior that you described.

i.e. wsl.exe -d "Debian"

Which looks like this on the shell

PS C:UsersPeterT> cd C:DEV
PS C:DEV> wsl.exe -d "Debian"
petert@debian:/mnt/c/DEV$
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement