X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Message-ID: <49920C32.7050507@cygwin.com> Date: Tue, 10 Feb 2009 18:22:26 -0500 From: "Larry Hall (Cygwin)" Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20090101 Remi/2.0.0.19-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: RFE?: CygWinDir in ENV? (was Re: How does one find where Cygwin was installed from Windows?) References: <4990B031 DOT 4050807 AT tlinx DOT org> <4990B128 DOT 7030004 AT cygwin DOT com> <4990CB8D DOT 3050704 AT tlinx DOT org> <4990D05A DOT 4050202 AT cygwin DOT com> <4990DA52 DOT 9050900 AT tlinx DOT org> <4990E0BF DOT 1010502 AT cygwin DOT com> <4990EC89 DOT 8070901 AT tlinx DOT org> <4991004F DOT 1080006 AT cygwin DOT com> <4991E1CC DOT 9060804 AT tlinx DOT org> <4991EB3C DOT 3090800 AT cygwin DOT com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Tim McDaniel wrote: > On Tue, 10 Feb 2009, Larry Hall (Cygwin) wrote: >> Tim McDaniel wrote: >>> I have several "trampoline" scripts, a bat file >>> doing nothing but invoking a corresponding bash shell script or Perl >>> program. I have to hard-code a location for the bash / perl >>> interpreter, but those locations change from user to user (some people >>> install under c:\, some under the standard location). I would like to >>> have the scripts work for any system. >> >> This can be done now, > > That appears to contradict what you wrote yesterday: Not really. See below. > ] If you need to do this generically for any batch file, then yes, you > ] have to rely on external data and heuristics. Going to the registry > ] to see if it will help or searching the file system are two > ] alternatives but there is no one key or one spot that will > ] unequivocally give you the installation path. Looking at the mount > ] paths in the registry will work for 1.5 but is flawed for 1.7. > ] Looking in the file-system may work depending on what you look for > ] and where you start looking. > > You did mention > > ] HKLM/Software/Cygwin/setup, the "rootdir" value. > > But you noted that that is in version 1.7. This would work for 1.5 as well if someone back-ported the 1.7 change. But unless someone makes some change to both the 'setup.exe' for 1.5 and the one for 1.7, you still won't have one place to look for this information. And even if this happens, it would only work for installations that have used the new 'setup.exe'. That may cover all 1.7 installations but it will be unreliable for 1.5 for... probably forever (or long enough that it will seem that way.) That doesn't mean that one can't create something that works "good enough" for one's needs. It just means that "there's no good way"(tm) to do this for all cases. If that's not a concern to you, then you diligently read this thread for its key points for nothing. ;-) If you're wondering where in the registry to find this information for 1.5 (assuming you're stuck with no other option), this FAQ should help point you in the right direction: > (When mentioning it, by the way, you might also mention REG.exe, a > program to do registry access, and the options for FOR that allow > running a program and getting the results in a variable in CMD.exe. > I hadn't heard of REG until I went searching just now.) Sounds similar to Cygwin's 'regtool'. Definitely would be helpful if you're trying to batch script something like this. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- 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/