Search code examples
windowsmavencommandcygwinexecute

Alias to open file on Windows using CygWin


I have a windows machine with CygWin installed on it. I do not hold any admin privileges, so, forget about changing environment variables which apply to all user and etc...

Scenario:

When I execute CygWin and type the following command to execute Maven, it works perfectly:

/cygdrive/c/maven/apache-maven-3.5.0/bin/mvn

However, when I create the file .profile as below:

alias mvn="cygdrive/c/maven/apache-maven-3.5.0/bin/mvn"

After restarting CygWing and executing the command "mvn", the following message is sent: No such file or directory.

Any suggestions?

Thanks in advance.


Solution

  • For any of you who may have the same problem, the way I solved this was basically adding a "sh" at the beginning of the command:

    elias mvn="sh /cygdrive/c/maven/apache-maven-3.5.0/bin/mvn"

    Cheers.