X-Recipient: archive-cygwin@delorie.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:subject:references:to:from:reply-to:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=fBEqBVDVBg4v82qD
	60GItC4rqdq8SGZlvcCGiUjZBOxvDC2oH8VUxGLJBufahpiV+kI1kN1aBPCJdDA/
	yFs9m5jLdygy+VIco+4kgJGJ0MazHWgmXibShAGJS7iVNasC9yj6DY9QWAJvDIVc
	dBT4WPErNqy91GJwtAVir7C9hkI=
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:subject:references:to:from:reply-to:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=QIktIWMqPfR5fwt6lqubcQ
	q2CeE=; b=thV94JWoAc4Hxid9Mr7wsI9dZ/C+dVHdTD5l+mWScokKLcm3O1z16k
	U0FSQ6CU5QcvQMF0+1OSKSmzIUMZsQxstJWgj5g6bOQaS/R/rAI3OhFltp9q5MPR
	5XNT8gkFtafDiX4M4FYczEEj2awdTecKg6fqbOtvyuy6EUlH822yQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*r:ip*192.168.1.100, Hx-spam-relays-external:!192.168.1.100!, H*RU:!192.168.1.100!, H*r:sk:smtp-ou
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=UpATD64B c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=yJAj4hAQ_G5E0g-aPcMA:9 a=QEXdDO2ut3YA:10
Subject: Re: Access windows environment variable via cygwin
References: <29cf87ff-beb3-5c22-eb47-ddb0ad6d4ae0@web.de>
To: cygwin@cygwin.com
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Message-ID: <95bf5921-78ab-c7ac-21a2-0f859e2f6c88@SystematicSw.ab.ca>
Date: Thu, 11 May 2017 21:07:34 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <29cf87ff-beb3-5c22-eb47-ddb0ad6d4ae0@web.de>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-CMAE-Envelope: MS4wfAylFgsfA2B3YjruTzESPtPmrfxm53UuW64FtQRp0xR6rMbwRBmNKLfqgqgNDv/IAUFRalEoSAiD6tKedaVgo77sbneJ7U2O3y06jJdVy2wrqkJhGEsm cwOfF4X0Xh1PsJXfPBLOg/pUX8683bXLdG33X2D57CroPzWNo4kkkEkjbyszhsUt9iCOEQXeh/1GFA==
X-IsSubscribed: yes

On 2017-05-11 19:14, ChampS wrote:
> I want to use Cygwin to access all Windows applications installed on
> my Windows 7 system. The Problem is that Windows is using spaces in
> its environment variable 'Path' and Cygwin can not handle the spaces.
> Is there a way to use the Windows environment variable 'Path' even
> with spaces in it? For Example I want to start x86 sbt via Cygwin,
> then I will get the following error message: "/cygdrive/c/Program
> Files (x86)/sbt/bin/sbt: line 61: /sbt-launch-lib.bash: No such file
> or directory". But when I try it with the default Windows cmd it
> works.

Cygwin has no problem with paths containing spaces.
Windows cmd will launch Windows programs in the registry even if their 
bin directories are not in your PATH, as will cygstart; otherwise  
Cygwin requires either that bin directories are in your PATH, or that 
you specify the full path to the executable when you run any program, 
and if there any spaces or other shell special characters in the full 
path, they needs quoted; quoting can use prefix \ or quotes e.g.
	/cygdrive/c/Program\ Files\ \(x86\)/sbt/bin/sbt
	'/cygdrive/c/Program Files (x86)/sbt/bin/sbt' as in ls or
	"/cygdrive/c/Program Files (x86)/sbt/bin/sbt". 

> Thought about something like iterating over the 'Path' environment
> variable in bashrc and adapt the strings to fit for Cygwin. But I
> don't know how I can access the Windows environment variables and how
> I could provide the adapted environment variable to Cygwin.

Cygwin automatically converts all directories in your PATH 
when you start a process.
From bash, echo "$PATH", to see what Cygwin has done.
Base utility cygpath -p allows you to do this on your own Windows 
environment variables like $CLASSPATH etc. as long as you properly 
quote the conversion e.g. 

$ CLASSPATH='C:\Program Files\Java;C:\Program Files (x86)\Java'
$ cp="$(cygpath -Up "$CLASSPATH")"
$ echo "$cp"
/proc/cygdrive/c/Program Files/Java:/proc/cygdrive/c/Program Files (x86)/Java
 
> Someone an idea how I could solve this issue?

If your scripts use environment variables, they should be careful 
to enclose uses of those variables in double quotes "$VAR".

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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

