delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/09/20:37:37

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4990DA52.9050900@tlinx.org>
Date: Mon, 09 Feb 2009 17:37:22 -0800
From: Linda Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: How does one find "cygdrive path" in a Win ".bat" file
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>
In-Reply-To: <4990D05A.4050202@cygwin.com>
X-Stationery: 0.4.8.12
X-Stationery: 0.4.8.12
X-Stationery: 0.4.8.12
X-Stationery: 0.4.8.12
X-Stationery: 0.4.8.12
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Larry Hall (Cygwin) wrote:
> Linda Walsh wrote:
>> Larry Hall (Cygwin X) wrote:
>>> Linda Walsh wrote:
>>>> The startxwin.sh script works, but startxwin.bat does not work if
>>>> your Cygwin installation isn't in the default location.
>>>>
>>>> You could use "mount -p" (presuming your cygwin\bin is in your 
>>>> windows path, as mine is).
>>>>
>>>> If not, need to look in the registry:
>>>> "\HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts 
>>>> v2\cygdrive prefix"
>>>
>>> No, you don't need to look in the registry.  There's nothing there that
>>> 'mount' won't tell you.  Forget about the registry.  You'll be better
>>> off, especially when Cygwin 1.7 is released.
>> ---
>>     I'm curious -- how does mount find or 'know' the cygdrive path
>> if it doesn't come from the registry.
> 
> How it finds it is an implementation detail.  There's no need to know
> how it does what it does if it does what you want. ;-)  And, like I said,
> the registry won't be used for 1.7 so anyone that uses this as a basis
> of anything will find it "broken" once 1.7 is released.
> 
>>     For that matter, how would a windows .bat file find the
>> 'mount.exe' binary if the .bat file doesn't know 'cygdrive path'?
> 
> That's a different issue. 
---
	Then answer the question.  First you avoid the answer by saying
it is an implementation detail.

	Then you say I'm implying a paradox that doesn't exist.

	I didn't write the windows .BAT file "startXWin.bat".

	If it is so easy to do, then why did you point me
at a broken solution in my earlier post?

You (Larry Hall (Cygwin)) wrote:
>> ... BUT allow no keyboard input.
> 
> Did you miss this FAQ?
> 
> <http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-i-cant-type-anything>

The FAQ first answer is:

	"Launch the X server via the shortcut under "Cygwin-X"
          on the start menu."
----
	Trouble is -- that script is broken.
	Why is it broken?  It's not an X problem.  It's a more general
problem of how does a ".bat" script in Windows find what the
"Cygdrive prefix" is, so it can call "/bin/mount" to find the
"Cygdrive prefix" it was looking for in the first place?


> However you imply a paradox that doesn't exist.  
---
	Looks paradoxical to me.

> Whether one knows the 'cygdrive path' or not will not make it
> easier to find 'mount.exe'.  'mount.exe' is always in '/bin'. 
---
	'/bin' is not a valid windows path.  You can't use that
as a path in a .BAT file and expect it to resolve correctly.


> As for
> the issue of finding '/bin', there may be times when it is necessary
> to script this, though I would say this is not one of those cases.
----
	I don't understand.  Why not?  You told me to start a Cygwin
program from the startmenu shortcut that was provided for it.  The shortcut
points to a windows .bat file that has \cygwin hard-coded in it.  It doesn't
find the correct path.

> For those cases, searching the file-system or spelunking in the
> registry are possible avenues, each with their own pluses and minuses.
> In this case, just looking at 'cygwin.bat' will provide the answer
> needed.
---
	It certainly doesn't on my machine.  Maybe it's changed and I don't
have an update, but my cygwin.bat file says:
-------------------
     @echo off
     C:
     chdir C:\\bin
     bash --login -i
-------------------

	Because cygwin.bat was installed by cygwin's setup.exe,
setup can fill in the value for "cygwin prefix" -- but nothing in
the above script tells me how a normal windows ".bat" file, independent
of setup.exe,  would get that information.



--
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