Cygwin/bash 别名中的空格?

发布于 2024-09-27 12:22:32 字数 257 浏览 0 评论 0原文

我正在尝试为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恋你朝朝暮暮 2024-10-04 12:22:32

转义字符:

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.

不气馁 2024-10-04 12:22:32

虽然上面的答案可以解决问题,但您可以尝试以下另一件事:

使用 微软的junction实用程序,用于创建“C:\ProgramFiles”“C:\Program Files”的符号链接(和“ C:\ProgramFiles86”到“C:\Program Files (x86)”)

Sample usage:
C:\>junction C:\ProgramFiles "C:\Program Files"

有趣的是,我上面给出的链接提到了“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)")

Sample usage:
C:\>junction C:\ProgramFiles "C:\Program Files"

Amusingly, the link I gave above mentions the exact same case of "Program Files" having a space in it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文