Cygwin: alias to Program Files (x86) directory

1

1

Using cygwin, I'm trying to create the following alias:

alias write="/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe"

When I execute the command to launch notepad++ directly, I have no issues. But when I alias it and then try to call write, I get an error:

-bash: syntax error near unexpected token `('

I've also tried removing the quotes and escaping the spaces and parens:

alias write=/cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe

and got the same result.

I have a workaround where I place a symlink to the executable in my home folder and alias write to the symlink, but I'd prefer to have it aliased directly. Is this possible?

ewok

Posted 2014-12-11T15:18:11.957

Reputation: 2 743

Answers

3

I'm trying to create the following alias

alias write="/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe"

Use the following command:

alias write='C:/Program\ Files\ \(x86\)/Notepad++/notepad++.exe'

Notes:

  • Change \ to /
  • Escape space , ( and )
  • Quote using '
  • Use the normal path instead of /cycgdrive/c/ (for a windows program not in the cygwin directory hierarchy)

DavidPostill

Posted 2014-12-11T15:18:11.957

Reputation: 118 938

This is due to the expand_aliases option of bash – Spacen Jasset – 2017-10-09T16:16:54.927