This is the mail archive of the
mailing list for the Cygwin project.
Re: Is there a way to acess expanded value of REG_EXPAND_SZ ?
- From: Linda Walsh <cygwin at tlinx dot org>
- To: cygwin at cygwin dot com
- Date: Tue, 05 Nov 2013 16:48:25 -0800
- Subject: Re: Is there a way to acess expanded value of REG_EXPAND_SZ ?
- Authentication-results: sourceware.org; auth=none
- References: <010002768 dot 20131105095723 at mtu-net dot ru>
On 11/4/2013 9:57 PM, Andrey Repin wrote:
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
sed -r 's/%([^%]+)%/\$\1/g'
on your string, then eval it...
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
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple