This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: A good way to test if cygwin isn't installed?

Andrew DeFaria wrote:
> Christopher Faylor wrote:
>> If you have cygwin programs available to you, then use the mount
>> command. If the only output from the mount command is of the
>> "noumount" variety then cygwin isn't installed in any meaningful way.
> Personally I would consider the existence or non-existence of
> cygwin1.dll to be a more definitive measure of whether or not Cygwin
> is installed in a "meaningful" way.
I think it may be possible to cygwin installed and not have it in the path,
if it's started from a bat or cmd that modifies the path etc...
anyway, finding cygwin1.dll may be a slow process. It might be better to
access the registry, this jscript uses the windows scripting host, so won't
work on older boxes unless wsh is there, but as a proof of concept it may be

---- start ----
// JScript.

var wsh     = new ActiveXObject("WScript.Shell") ;
var KEY9X   = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" ;
var OsRoot  = "?" ;
var CygRoot = "Cygwin Not Found" ;

try { 
  OsRoot = wsh.RegRead(KEY9X+"Version")
  } catch(err) {}
  if ( OsRoot != "?" ) {                             // Win9x or Me
    cygkey = "This needs determining - I have no 9x box to test" ;
    try {	 
      CygRoot = wsh.RegRead(cygkey);
      } catch(err) {}
  else {                                            // NT or 2000
    var cygkey = "HKLM\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts
    try {	 
      CygRoot = wsh.RegRead(cygkey);
      } catch(err) {}

---- end ----
when run it should give the foder mounted as '/'. It also won't work on a
9X/ME box as I don't know the registry key for that without digging.
When I get home I may have time to hack this together as a standalone, if
anyone is interested.
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\

This e-mail transmission is strictly confidential and intended solely
for the person or organisation to whom it is addressed. It may contain
privileged and confidential information and if you are not the intended
recipient, you must not copy, distribute or take any action in reliance
on it. If you have received this email in error, please reply to the
sender as soon as possible and delete the message. Please note that we
are able to, and reserve the right to, monitor e-mail communications
passing through our network.

The views expressed in this email are not that of the company unless
specified within the message.

The inclusion of this footnote indicates that the mail message and any
attachments have been checked for the presence of known viruses.

If you have any comments regarding our policy please direct them to
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]