From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14413 invoked by alias); 6 Aug 2019 15:20:34 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 14354 invoked by uid 89); 6 Aug 2019 15:20:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Envelope-From:sk:michael, H*r:4.77 X-HELO: atfriesa01.ssi-schaefer.com Received: from atfriesa01.ssi-schaefer.com (HELO atfriesa01.ssi-schaefer.com) (193.186.16.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Aug 2019 15:20:31 +0000 Received: from samail03.wamas.com (HELO mailhost.salomon.at) ([172.28.33.235]) by atfriesa01.ssi-schaefer.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 17:20:28 +0200 Received: from fril0049.wamas.com ([172.28.42.244]) by mailhost.salomon.at with esmtp (Exim 4.77) (envelope-from ) id 1hv1GG-0000E9-Fz; Tue, 06 Aug 2019 17:20:28 +0200 To: cygwin@cygwin.com From: Michael Haubenwallner Subject: How to query the value of %SystemDrive% in an empty environment? Openpgp: preference=signencrypt Message-ID: <089bb243-1dbb-048a-39aa-f54048a39e26@ssi-schaefer.com> Date: Tue, 06 Aug 2019 15:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00072.txt.bz2 Hi, 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? Thanks! /haubi/ -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple