如何将 \\wsl$\ 类型的 unc 路径映射到 Windows 驱动器号?

Gon*_*n I 3 windows unc drive-mapping windows-subsystem-for-linux

我在 Windows 上使用 Eclipse 连接到 wsl 上的文件,并且遇到了明显的 Eclipse 错误,该错误导致 \wsl$\folder1\pom.xml 等文件名被破坏。 https://bugs.eclipse.org/bugs/show_bug.cgi?id=577938

错误报告中的评论提出了可能的解决方法

A workaround is to map the UNC path to a drive letter, but this shouldn't be necessary
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

ian*_*ian 7

我这样做了(驱动器j:可用)

net use j: \\wsl$\Ubuntu
Run Code Online (Sandbox Code Playgroud)

请注意,这是持久性的,如果不删除可能会导致 wsl2 自行重新启动。完成此操作后,我可以从 Windows emacs 访问 Ubuntu 发行版上的文件。

删除它:

net use /del j:
Run Code Online (Sandbox Code Playgroud)