Cygwin/bash 别名中的空格?
我正在尝试为 Cygwin bash shell 设置别名,以运行标准 Windows C:\Program Files 子目录中包含的程序。不幸的是,alias 命令确实不喜欢目录名称中的空格,而且我尝试过的任何方法似乎都不起作用。我正在尝试运行以下命令:
alias npp='/cygdrive/c/Program Files/Notepad++/notepad++.exe'
我目前正在作弊并使用软链接,但我更愿意使用别名。
I am attempting to set up aliases for my Cygwin bash shells, to run programs contained in the standard Windows C:\Program Files subdirectories. Unfortunately, the alias command really doesn't like spaces in a directory name, and nothing I've tried seems to work. I'm trying to get the following running:
alias npp='/cygdrive/c/Program Files/Notepad++/notepad++.exe'
I am currently cheating and using a soft link, but I would prefer to use an alias.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转义字符:
alias npp="/cygdrive/c/Program\ Files/Notepad++/notepad++.exe"
编辑:还要注意从单引号到双引号的更改。
Escape Characters:
alias npp="/cygdrive/c/Program\ Files/Notepad++/notepad++.exe"
Edit: Note the change from single to double quotes as well.
虽然上面的答案可以解决问题,但您可以尝试以下另一件事:
使用 微软的
junction
实用程序,用于创建“C:\ProgramFiles”
到“C:\Program Files”
的符号链接(和“ C:\ProgramFiles86”到“C:\Program Files (x86)”)有趣的是,我上面给出的链接提到了“Program Files”中包含空格的完全相同的情况。
While the answer above will solve the problem, here is another thing you can try:
Use
junction
utility from microsoft to create a symlink"C:\ProgramFiles"
to"C:\Program Files"
(and "C:\ProgramFiles86" to "C:\Program Files (x86)")Amusingly, the link I gave above mentions the exact same case of "Program Files" having a space in it.