WSL 中的 $PATH 应该很长吗?

ser*_*rm1 4 environment-variables windows-subsystem-for-linux

其他人使用echo $PATH命令获得超长路径吗?我正在 Windows 应用商店的 Windows 上使用 BASH shell Ubuntu。

的输出echo $PATH

home/mnhir/bin:/home/mnhir/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Users/hersh/AppData/Local/Microsoft/WindowsApps:/snap/bin
Run Code Online (Sandbox Code Playgroud)

mur*_*uru 11

注释几乎不可读,但看起来您的 Windows%PATH%已附加到 Linux $PATH. 情况大概就是这样。请参阅WSL 与 Windows 的互操作性

为了使 Windows 可执行文件更易于运行,Windows 路径包含$PATH在秋季创意者更新中的 Linux中。

如果不需要,显然可以使用 Windows 注册表禁用此功能。

  • 这不是写作本身,而是缺乏格式。最好使用代码格式将长命令输出添加到原始帖子中,而不是将其粘贴到注释中。http://askubuntu.com/editing-help#code (2认同)

Ben*_*ith 10

在 WSL 中,您现在可以$PATH通过编辑/etc/wsl.conf文件来禁用添加 Windows 路径。您可能需要重新启动 WSL 会话才能使此更改生效。

其内容示例如下:

[interop]
appendWindowsPath=false
Run Code Online (Sandbox Code Playgroud)

更多信息可以在这里找到。