gpt4 book ai didi

windows - 如何在 Fall Creators Update 中从 WSL 中获取 Linux 安装路径

转载 作者:可可西里 更新时间:2023-11-01 10:42:14 29 4
gpt4 key购买 nike

在最近更新之前,WSL 根文件系统总是在 C:\Users\%username%\AppData\Local\lxss 中,但现在当从 App Store 安装 Linux 时,它可能会有所不同每次安装。例如,对于我机器上的 Ubuntu,它是 C:\Users\%username%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs

有没有办法从当前 WSL session 中检测到这条路径?

最佳答案

正如其他用户所说,现在您可以安装多个 Linux 发行版,每个发行版都有自己的文件系统,位于不同的文件夹中。可以从 Windows 注册表中获取每个文件系统的位置。

您可以运行 regedit 并查找信息。数据位于

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss

此外,您可以启动PowerShell窗口并执行以下命令来确定所有已安装的Linux发行版的信息。

(Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss" -Recurse)

要获取文件系统的位置,您可以运行

(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}) | select DistributionName,BasePath

关于windows - 如何在 Fall Creators Update 中从 WSL 中获取 Linux 安装路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46877300/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com