Can I find where cygwin is installed (for automation purposes)

Paul Moore
Wed Apr 15 10:29:30 GMT 2020

I'm trying to write an automation script that works on a number of
machines. I know that on all machines Cygwin will be installed, but I
cannot guarantee that (1) it will be in the same location on each PC,
or (2) that it will be in PATH.

There's HKCU\Software\Cygwin\Installations, but that seems to use \??
prefixes on the PATH, which I'm not sure how to interpret (I know
about \\?\ prefixes, but this is different, I assume?), and it also
includes some non-Cygwin things (one machine I have, has

So far, the best I can see is to try every entry in there, strip \??,
and look for a cygwin1.dll, and use the first entry I find that works.
But that seems a bit arbitrary. Is there a better way?


More information about the Cygwin mailing list