How to translate the wslpath /home/user/ to windows path

二次信任 提交于 2021-02-18 18:40:14

问题


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.


回答1:


Updated guidance for users of Windows 10 1809 or later:

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:

Warning for WSL1 users:

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.



来源:https://stackoverflow.com/questions/53474575/how-to-translate-the-wslpath-home-user-to-windows-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!