From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Cc: cygwin@cygwin.com
Subject: Re: How to query the value of %SystemDrive% in an empty environment?
Date: Wed, 07 Aug 2019 11:19:00 -0000 [thread overview]
Message-ID: <20190807111943.GC11632@calimero.vinschen.de> (raw)
In-Reply-To: <ebba0d18-d4d1-dd3c-bd52-b91489106cbf@ssi-schaefer.com>
[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]
On Aug 7 13:08, Michael Haubenwallner wrote:
> On 8/7/19 4:33 AM, Brian Inglis wrote:
> > On 2019-08-06 09:20, Michael Haubenwallner wrote:
> >> using 'env -i' to create an empty environment, the SYSTEMROOT and WINDIR
> >> environment variables are preserved (or recreated):
> >> $ /usr/bin/env -i /usr/bin/env
> >> SYSTEMROOT=C:\Windows
> >> WINDIR=C:\Windows
> >> And with cygpath, there is the -A, -D, -H, -O, -P, -S, -W and even -F flags
> >> to query the values for various directories.
> >> Now what I've failed to find is how to query the value for the "SystemDrive"
> >> environment variable.
> >> The problem behind is that I'm using "vswhere.exe" to locate some Visual Studio
> >> environment from within some scripts run via 'env -i', causing vswhere.exe to
> >> create a directory named "%SystemDrive%" in the current working directory:
> >> So I better ensure the SystemDrive environment variable is set for vswhere.exe.
> >> Any ideas?
> >
> > There is a reg entry:
> >
> > $ head
> > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SystemBootDevice;
> > echo
> > multi(0)disk(0)rdisk(1)partition(3)
> >
> > but how do you convert that to a device letter?
> >
> > SYSTEMDRIVE is a dynamic env var created at startup pointing to the boot drive
> > letter. It is not instantiated anywhere else as far I could find. A number of
> > low level reg entries use that env var. Only option is to pass it through:
>
> Heck, even CreateEnvironmentBlock() relies on SYSTEMROOT env var being set,
> otherwise returning things like ProgramData="%SystemDrive%\ProgramData".
So, what does this have to do with Cygwin in case you clean out the
environment? This is nothing you want to do if you plan to start
a non-Cygwin executable.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-08-07 11:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 15:20 Michael Haubenwallner
2019-08-06 15:41 ` Corinna Vinschen
2019-08-06 15:47 ` Bill Stewart
2019-08-06 15:53 ` Corinna Vinschen
2019-08-06 16:10 ` Bill Stewart
2019-08-06 16:25 ` Corinna Vinschen
2019-08-06 17:08 ` Bill Stewart
2019-08-07 2:33 ` Brian Inglis
2019-08-07 11:09 ` Michael Haubenwallner
2019-08-07 11:19 ` Corinna Vinschen [this message]
2019-08-07 12:41 ` Michael Haubenwallner
2019-08-07 14:31 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190807111943.GC11632@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
--cc=michael.haubenwallner@ssi-schaefer.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).