# obtain the value of the ID of the default Linux distribution (and store it in a variable to avoid escaping characters issues):
$DEFAULT_LXSS_ID = (Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\ -name DefaultDistribution)
# which will have a value like:
echo $DEFAULT_LXSS_ID
{bde539d6-0c87-4e12-9599-1dcd623fbf07}
# display the directory containing the rootfs Windows directory (mapped to the / Linux directory)
Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\$DEFAULT_LXSS_ID -name BasePath | Format-List -property "BasePath"
%LocalAppData%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState
。
# obtain the value of the ID of the default Linux distribution (and store it in a variable to avoid escaping characters issues):
$DEFAULT_LXSS_ID = (Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\ -name DefaultDistribution)
# which will have a value like:
echo $DEFAULT_LXSS_ID
{bde539d6-0c87-4e12-9599-1dcd623fbf07}
# display the directory containing the rootfs Windows directory (mapped to the / Linux directory)
Get-ItemPropertyValue -Path REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\$DEFAULT_LXSS_ID -name BasePath | Format-List -property "BasePath"
%LocalAppData%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState
对于从Windows商店安装的Ubuntu。
对于WSL2,你可以从Windows(Windows 10 build 18342)访问主目录,像这样。
在Windows Subsystem for Linux的早期版本中,Ubuntu的文件系统在
%localappdata%\Lxss
(例如,C:\Users\Username\AppData\Local\Lxss
- 在Windows中用你的用户名替换Username)。见WSL博客中关于文件系统支持的文章。注意
在Linux子系统中使用Windows应用程序&工具创建/修改任何文件都会导致Ubuntu子系统的数据损坏和数据丢失!(感谢Rich Turner提出的这些建议!)这将导致Ubuntu子系统的数据丢失。(感谢Rich Turner提出的这些警告!) 这绝对是不支持的。来自同一篇博客文章。
你的Windows文件系统在Bash shell环境中位于
/mnt/c
。![在此输入图像描述][3] 。
来源。Dustin Kirkland'的博客, howtogeek
自从Bash最初问世以来,这一点似乎已经发生了变化,并且不适用于来自Windows商店的发行版,也可能不是对所有系统都一致,因为我的主目录位于另一个地方。
或。
其中
{user}
是您的Windows用户名,{username}
是您在安装时设置的UNIX用户名。所以根目录应该是:
请注意,根目录在Windows Explorer中可能无法从
%localappdata%
目录看到。无论如何,你应该能够通过在资源管理器的'地址栏中输入它来访问它。如果你从MS Market安装Linux。
他们将 distros 放在。
默认发行版的定义是:
Linux根基较深。
PS.我用Cygwin探索注册表键。 我使用Cygwin来探索注册表键。
如果使用PowerShell来实现同样的目标,命令应该是:
。
PPS. https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
唯一对我有效的是
%localappdata%/lxss/home/{username}
,其中{username}
是你在安装时给的BASH用户名。 不知为什么,显示隐藏文件夹后'的lxss拒绝出现在C:/Users/WINDOWS-USER/AppData/Local/
中,同时给出完整的C:/
路径与windows和BASH用户名也不行。还请你建立一个桌面快捷方式来解决什么问题。
你可以在打开的文件夹的文件资源管理器窗口中通过在位置栏中输入
bash
来快速打开Bash。这就够了。
你也可以添加一个上下文菜单项。如果不需要的话,我个人不建议这样做,因为在上下文菜单中添加快捷方式会占用更多的内存。
https://www.howtogeek.com/270810/how-to-quickly-launch-a-bash-shell-from-windows-10s-file-explorer/