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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=E6ayAiPSM3vpvHHv3mmBkyPZ4AS67jBpqaYb84bZ+rE LcS9dxPo4gjhCKFE2Hz9aKXlvCgPeICvwQKKsZrvUdl1JZPp2WgeQ4sj1O4u72Ga O3A3wPfhGxakES8bZrQbWmGgOpz7d1rW8dZ7MdLbTQFomM/m9J5iWS4P8wyOROFg = 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=ogzdfLROZQDthrKHW+ewjLW5fYo=; b=GYC/Xt7u214SnovCY xjXRSnXb7aslWHFyp+7Kl/JJ9UCXRjRk4pa0mk1WeWzZEHYhZGBHowOM4S8DZjyJ gcEoSvERbtFfkc25yC6ErRl9E5wr+D/2pycgWwJwmsC8OrHnmQ7H0Gqj5w4xg3S1 sZjwS9ehLdsv5uO59DmsU7a/Mc= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_50,RDNS_NONE autolearn=no version=3.3.2 X-HELO: Ishtar.tlinx.org Message-ID: <527991D9.4090605@tlinx.org> Date: Tue, 05 Nov 2013 16:48:25 -0800 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Is there a way to acess expanded value of REG_EXPAND_SZ ? References: <010002768 DOT 20131105095723 AT mtu-net DOT ru> In-Reply-To: <010002768.20131105095723@mtu-net.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 11/4/2013 9:57 PM, Andrey Repin wrote: > Greetings, All! > > Started to write scripts, that rely on registry, and hit a nail right off the > bat. I need to access expanded value of REG_EXPAND_SZ type. > Reading documentation doesn't help. > Is this possible? > Or should I go through a loop of calling cmd.exe to manually expand variables? ----- You might want to read the strings then use 'sed' to replace to do: sed -r 's/%([^%]+)%/\$\1/g' on your string, then eval it... something like: shvar="$(echo "$RG_XPND_S"|sed -r 's/%([^%]+)%/\$\1/g')" value= eval "echo $shvar" --- The above is untested, but it should point you in the right direction...(crossing fingers). -- 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