delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/01/13:10:30

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-VirusChecked: Checked
X-Env-Sender: Bill DOT Hughes AT cox DOT co DOT uk
X-Msg-Ref: server-14.tower-14.messagelabs.com!1096650617!17525064
X-StarScan-Version: 5.2.10; banners=cox.co.uk,-,-
X-Originating-IP: [62.172.235.173]
Message-ID: <D9B1ABFA3404D611AC7B00508B63B5120128F1E2@nnhml1.cox.co.uk>
From: "Hughes, Bill" <Bill DOT Hughes AT cox DOT co DOT uk>
To: cygwin AT cygwin DOT com
Subject: RE: A good way to test if cygwin isn't installed?
Date: Fri, 1 Oct 2004 18:08:48 +0100
MIME-Version: 1.0
X-IsSubscribed: yes

Andrew DeFaria wrote:
> Christopher Faylor wrote:
..snip.. 
>> 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
ok.

---- 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
v2\\/\\native";
    try {	 
      CygRoot = wsh.RegRead(cygkey);
      } catch(err) {}
  }

WScript.Echo(CygRoot);
---- 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.
Bill
-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.tigris.org


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
postmaster AT cox DOT co DOT uk
________________________________________________________________________
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
http://www.messagelabs.com
________________________________________________________________________

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019