I use Linux subsystem of windows 10(windows 10 version 1803)
I can use command line:
user@laptop:~$ wslpath -w /c/
C:\
But when I try to use
user@laptop:~$ wslpath -w ~
wslpath: /home/user: Result not representable
Even I use:
user@laptop:~$ wslpath -w /home/user
wslpath: /home/user: Result not representable
why? how to translate the /home/user to windows path?
my home folder path in windows is C:\Users\winuser\AppData\Local\lxss\home
I expect some command line can give me return that string.
In Windows 10 1809, we (finally) shipped filesystem integration allowing you to access the files in your WSL distros from Windows via the \\wsl$
UNC path:
If you're interested in the details behind how this works, please visit this blog post: https://devblogs.microsoft.com/commandline/a-deep-dive-into-how-wsl-allows-windows-to-access-linux-files/
This now allows wslpath
to provide a Windows-accessible path to files within your distro's filesystem:
In the up-coming Windows 10 May 2020 Update (2004), you won't have to remember the somewhat obscure \\wsl$\
UNC path - instead you'll just click on the Tux (Linux penguin) icon in your File Explorer:
Do not try to spelunk to the %localappdata%\lxss\...
folders containing your WSL1 Linux files from Windows - there be dragons!
Please read this post: https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
This guidance has not, and will not change, though it will become less important over time: In particular, WSL2 does not use %localappdata%\lxss
- instead it stores your linux files within EXT4 formatted VHDX files delivering near-native IO performance for the distro's local filesystem.
To convert a WSL Linux path to a Windows path use wlspath -w
. For example:
$ wslpath -w /mnt/c/Users
C:\Users
$ wslpath -w /usr/bin
\\wsl$\Debian\usr\bin
(Yep, the answer is in the question, but some people, like me, are going to skip straight to the answers without reading the question.) The problem reported by the OP doesn't exist in WSL2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With