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: How does one find "cygdrive path" in a Win ".bat" file

Linda Walsh wrote:
Larry Hall (Cygwin) wrote:
Linda Walsh wrote:
Larry Hall (Cygwin X) wrote:
Linda Walsh wrote:
The 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.

<long winded response deleted>

Linda, you've been around this list long enough to understand how to
handle them.  Please, if you want to berate someone for answering
your posts, do it on one list only.  Of course, I'm having trouble seeing
the benefit of continuing with either thread, given your stubbornness to
hold onto the notion that there must be a complicated way to solve this
problem.  So let me summarize once more.  You can take it as your answer
or not.

  1. Going to the registry in general for information you can get from
     the Cygwin 'mount' command is not supported and is error prone.

  2. Providing the proper path in 'startxwin.bat' does not require
     special analysis of the registry, file system, or any other source
     to find the proper root for Cygwin.  There are at least two ways of
     directly solving this robustly:

       a. Have 'setup.exe' do it, like it does for 'cygwin.bat'
       b. Use the path to 'startxwin.bat' as the path (it is in the
          Cygwin installation path after all).

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

Hopefully this summary of what I've said already is clear and compact
enough for you to understand what I'm saying.  If not, I'll leave you
to enjoy your continued quest unimpeded by more answers from me.
If you don't like this answer, please feel free to post more long-winded
prose that picks each word of my response apart such that it looses all
context.  But I think it's fair to say that the thread will end after that.
There's really nothing worthwhile that can be said relative to your inquiry
that hasn't already been covered.

Larry Hall                    
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:
Problem reports:

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