简体   繁体   English

使用CygWin在Windows上打开文件的别名

[英]Alias to open file on Windows using CygWin

I have a windows machine with CygWin installed on it. 我有一台装有CygWin的Windows机器。 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: 当我执行CygWin并键入以下命令以执行Maven时,它可以完美运行:

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

However, when I create the file .profile as below: 但是,当我如下创建文件.profile时:

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 . 重新启动CygWing并执行命令“ mvn”后,将发送以下消息: 没有此类文件或目录

Any suggestions? 有什么建议么?

Thanks in advance. 提前致谢。

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: 对于可能遇到相同问题的任何人,我解决此问题的方法基本上是在命令开头添加“ sh”:

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

Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM