Web lists-archives.com

Re: Get Cygwin home directory path for current user

On 15.02.2019 2:41, Bill Stewart wrote:
> On Thu, Feb 14, 2019 at 4:32 PM Vince Rice wrote:
>> I didn't suggest everyone did. But people who want tilde expansion do, because it's
>> the shell that is responsible for tilde expansion.
>> ...
>> No, it isn't "oddly" absent. As has been said repeatedly in this thread, tilde expansion
>> is the responsibility of the shell. Cygwin has nothing to do with it. The *shell* does
>> it.
>> ...
>> Because, repeat after me, IT'S THE SHELL THAT DOES THE EXPANSION!
> (?) I understand that the shell does ~ expansion. I am asking for a
> way to get that particular path (forget about the ~ character for the
> time being) without needing to invoke a Cygwin shell in the first
> place. (That was the whole point of the request.)

This is not *exactly* without invoking Cygwin shell, but i don't see how the
difference matters:

c:/cygwin/bin/bash.exe --login -c "cygpath -w ~"
c:/cygwin/bin/bash.exe -c "/bin/cygpath -w ~"

either would work.

If you don't want to hardcode c:/cygwin, use registry functions to grab the
contents of Computer\HKEY_CURRENT_USER\Software\Cygwin\Installations somehow. I
don't know PowerShell, but with reg.exe that would be:

reg query HKEY_CURRENT_USER\Software\Cygwin\Installations

and then you'd have to filter out one of the installations out of that.

Attachment: signature.asc
Description: OpenPGP digital signature