X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=cOZ XROYwBUFlst8XoelXnYx1+0C8B4j2UAiqlM5jEN22c+LRIMWS0LuOXfM931eK373 6IvH0IgcmAwy8+7etWXlG37DU4D4B9w9+kD6sn8GkbyWpEbwthn97mnynvpG+BvZ rJfrZZ6mDLEEZRD3XBv5tMv2m9ejalq0ytQ6II8k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=LDRKgatm0 8LY1/SFNnbzmBD8rtA=; b=xzYR2XiQB9GNQbvU8dK8o1wGclNBqG4hsLdWTgLsz iSMFlaVYYSI/Jg/ljvP95XiXj9/nJh/kSOZwWR0y1VhLvmz1eu+e6KSH46bty7lp 5fj/2YTRYxz1KqE4guQtvLFY6VU8tUO3WJsxvS19wkr93Ko7k2pX458/eT8wvsU1 Co= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 To: cygwin AT cygwin DOT 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, 6 Aug 2019 17:20:28 +0200 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 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