linux - 当 Windows PATH 的文件夹名称带有空格时,WSL(Windows 子系统 linux)会破坏 $PATH

标签 linux windows windows-subsystem-for-linux

当我启动 WSL 时,我无法将文件夹添加到路径。我发现这是因为 Windows PATH 中包含的文件夹名称中包含空格会破坏 linux $PATH。
:
例如,当将 $PATH 放在命令行中时,我得到
....其他一些文件夹...:/mnt/c/Program: 没有这样的文件或目录。

如果这是一个手动过程,我会使用 Program\文件的“程序文件”,但这是在 ~/.bashrc 开始之前导入的,所以我不知道如何解决这个问题。

感谢您的帮助

最佳答案

我在创建 Ubuntu 20.04 的第二个实例并通过/etc/wsl.conf 设置默认用户时遇到了同样的问题。在/etc/profile.d/apps-bin-path.sh 中的第 6 行( export PATH=$PATH:${snap_bin_path} )引用 $PATH 为我解决了这个问题。

关于linux - 当 Windows PATH 的文件夹名称带有空格时,WSL(Windows 子系统 linux)会破坏 $PATH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62429828/

相关文章:

c - 如何在C字符串中写入和读取一个以上的单词

linux - 如何检测 Go 中的操作系统版本?

windows - Windows XP 真的有负错误代码吗?

c++ - 显示 C :\Windows\System32\config using C++ 的内容

c++ - 如何在 Windows 中使用 c/c++ 中的 curl 获取网络视频流的快照?

windows - 由于空间问题,WSL 无法找到文件或目录

c++ - Unix 中的 MakeFile 错误

linux - 根据大小和模式在 unix 中拆分大文件

容器化 Linux 环境中的 C++ : why does attempting to allocate large vector causes SIGABRT or neverending loop instead of bad_alloc?

shortcut - 如何在 Windows 命令行中通过 WSL 调用 Linux 命令?