保持Windows 10路径和“Bash on Ubuntu on Windows(WSL)”路径同步的最佳方法是什么?
我已经将Windows 10路径(转换为bash兼容)附加到.bashrc,但bash shell似乎没有拾取它。
我采取的步骤:
1.获取Windows路径〉echo %PATH%
1.选择相关路径并转换为bash兼容(例如,C:\Java变为/mnt/c/Java)
1.启动bash并编辑.bashrc
1.附加到.bashrc,例如〉导出路径=${PATH}:/bin:/mnt/c/Java/bin:/mnt/c/节点
2条答案
按热度按时间mspsb9vt1#
从Insider build 145963(ish)开始,您无需在.bashrc中附加Windows路径:
在后续版本中,以及从Creators Update开始,WSL会自动将Windows路径附加到您的Bash路径,允许您从Bash中启动Windows可执行文件,而无需输入路径上可执行文件的绝对文件夹位置。
例如,导航到C:驱动器,创建一个文本文件并在记事本中打开:
提示:不要忘记
.exe
扩展名--它告诉Linux请求WSL启动.exenr9pn0ug2#
我想那是你希望的。
自动将您的Windows路径转换为Bashrc:
https://github.com/hypolas/wintobashpath
https://github.com/hypolas/wintobashpath/releases/tag/v1.0.0
变成:
我是为了自己。