Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <40D1AA0F.7010306@yahoo.fr> Date: Thu, 17 Jun 2004 16:26:23 +0200 From: bertrand marquis Reply-To: bertrand_marquis AT yahoo DOT fr User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.2.1) Gecko/20030225 MIME-Version: 1.0 To: Luc Hermitte Cc: cygwin AT cygwin DOT com Subject: Re: find the path for cygwin root from windows script References: <40D16060 DOT 6040604 AT yahoo DOT fr> <20040617125436 DOT GA3164 AT jade> In-Reply-To: <20040617125436.GA3164@jade> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on donald.sysgo.com X-Spam-Level: X-Spam-Status: No, hits=-1.5 required=5.0 tests=BAYES_01 autolearn=no version=2.61 X-AntiVirus: checked by AntiVir MailGate (version: 2.0.1.16; AVE: 6.25.0.62; VDF: 6.25.0.99; host: mailgate.sysgo.de) X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i5HEMi65026172 Luc Hermitte a écrit: >Hello, > >* On Thu, Jun 17, 2004 at 11:12:00AM +0200, bertrand marquis wrote: > > >> i need to be able to find where cygwin is install from a .bat script >>under windows to run cygwin programs. >>Does anyone has a solution to do that automaticaly ? >> >> > > cygpath -m / > I agree that is working but only if your path is set correctly and to do that you need to know where cygwin has been installed > >However, this solution requires that cygwin directories are visible from >your $PATH. In other words, you won't really need to know where they are >installed. > > > Anyway i found a solution looking into the windows registry where this is writting when cygwin is installed. Here is an example which start an xterm. ::start of file xterm.bat @echo off SET DISPLAY=127.0.0.1:0.0 REM Look for cygwin entry in windows registry REGEDIT /E %Temp%.\tmp-cygwin.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/"> nul REM Check if something has been found if not exist %Temp%.\tmp-cygwin.reg goto EXITNOCYGWIN REM Get the native key from windows registry result FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%.\tmp-cygwin.reg ^| FIND "native"') DO SET CYGWIN_ROOT=%%B> nul REM Remove quotes SET CYGWIN_ROOT=%CYGWIN_ROOT:"=%> nul REM Remove temporary file if exist %Temp%.\tmp-cygwin.reg del %Temp%.\tmp-cygwin.reg REM Check if we have found something if "%CYGWIN_ROOT%" == "" goto EXITNOCYGWIN REM Export Cygwin path SET PATH=.;%CYGWIN_ROOT%\bin;%CYGWIN_ROOT%\usr\X11R6\bin;%CYGWIN_ROOT%\opt\elinos\bin;%PATH% run xterm exit :EXITNOCYGWIN echo no cygwin entry has been found in registry pause ::end of file I only have two questions left: - is HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2 always the place where i can find the mounts in the registry - is there a way to check that there is actually a X server running on 127.0.0.1 from a windows script. As this if there isn't i could start one. -- 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/