Ubuntu – Bash on Ubuntu on Windows 10 translate working directory

directorywindows-subsystem-for-linux

How do I translate a directory in Bash on Ubuntu on Windows 10 so that I can invoke a Windows application via Bash and call that working directory as an option?

For Example:

From Bash on Ubuntu on Windows 10, I can get the path to my WindowsC:\ drive through /mnt/c/, which is useful for opening Windows-based GUI applications from the Bash command line; for instance, I can open Sublime Text with:

/mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe

but I'm not sure how to use a command line option that will instruct the Windows application to use something in my current working directory. like:

pwd
/home/mark/example
ls
test.txt
mwalle@DESKTOP-LO101K6:~/lyn_solns$ /mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe test.txt
Unable to translate current working directory. Using C:\WINDOWS\system32

and Sublime Text opens up displaying a new blank file named test.txt in the C:\WINDOWS\system32 folder. I expected it to open the existing test.txt in ~\example.

Best Answer

I eventually found an answer here: Where is the Ubuntu file system root directory in Windows NT subsystem and vice versa?. The command to access my Ubuntu user's test.txt inside the windows application sublime from the Ubuntu subsystem Bash:

/mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe C:\\Users\\Mark\\Ap
pData\\Local\\lxss\\home\\mwalle\\test.txt
Related Question