Are there any drawbacks when replacing Windows' functions with Cygwin's in the PATH?

1

Cygwin allows executing shell scripts on Windows and many more. Some functions conflict with the Windows Shell's functions.

Does the following hint lead to any disadvantages when using Windows regularly? I could not find any additional information about this.

Cygwin states:

A few Windows tools, such as find.exe, link.exe and sort.exe, may conflict with the Cygwin versions make sure that you use the full path (/usr/bin/find) or that your Cygwin bin directory comes first in your PATH.

I changed my PATH accordingly, but I wonder whether there are any drawbacks. When does Windows use, e.g., find by shell command?

Xiphias

Posted 2014-03-12T13:50:56.360

Reputation: 145

It will primarily matter if you have batch scripts that are expecting the windows version of the utility. For instance if you have a batch logon script that parsed the results of find.exe for some crazy reason. To be honest with you I would expect the risk to be low personally. – EBGreen – 2014-03-12T14:16:39.167

Answers

2

You have to think bigger, since find.exe and sort.exe are default Windows tools that are available on most Windows machines. It is also possible that other programs apart from Windows use them.

A common situation when command-line tools are used in Windows is the installation of something. This could be a new program manually installed by yourself or an (automatic) update of Windows (or other already installed programs). The problem here is, that it is very hard to predict what will happen. A well written program/scrip will just end with a meaningful error message. But there could also be a script that relies on the exact behavior of these tools and runs havoc when you change them.

Do you need these cygwin tools in your path? If you only need them occasionally you could add them temporarily to your path when you want to use them:

path=C:\your_path_here;%PATH%

(edit: the new path needs to be in front so that the cygwin executables are preferred to the windows ones)

masgo

Posted 2014-03-12T13:50:56.360

Reputation: 1 541

@EBGreen you are right, I edited the answer. – masgo – 2014-03-12T16:24:51.880

The big thing to take away, Windows find.exe works quite different than Cygwin find.exe. The Windows one is more like grep than a file find. This inconsistency would break tools that shell out, expecting the Windows functionality. – Rich Homolka – 2014-03-12T16:53:46.103