问题描述
我希望能够从Windows的Ubuntu上的Bash的命令行中打开sublime文本编辑器,但是每次尝试运行命令'subl'时,我都会被
I would like to be able to open the sublime text editor from the command line from Bash on Ubuntu on Windows, but each time I attempt to run the command 'subl' I get hit with
-bash: C:/Program Files/Sublime Text 3/sublime_text.exe: No such file or directory
这绝对是正确的目录,但是我不知道为什么它不起作用.有提示吗?
This is definitely the right directory, but I have no clue as to why this isn't working. Any tips?
推荐答案
-
以管理员身份运行记事本.
Run notepad as administrator.
复制并复制将以下两行代码粘贴到下面:
Copy & paste this two line of code below:
#!/bin/bash
"$(dirname "$0")/subl.exe" "$@"
将其另存为C:\ Program Files \ Sublime Text 3中的subl.txt
Save it as subl.txt inside C:\Program Files\Sublime Text 3
打开文件夹"C:\ Program Files \ Sublime Text 3"
Open the folder 'C:\Program Files\Sublime Text 3'
最后右键单击,然后将此文件重命名为subl.这意味着从该文件中删除.txt扩展名.
Finally right click and rename this file to subl. That means remove the .txt extension from that file.
现在,您可以在gitbash或wsl linux终端上使用subl命令了.
Now, you are ready to use subl command on gitbash or wsl linux terminal.
这篇关于无法在Windows上的Ubuntu上的Bash中打开Sublime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!