This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is there a way to acess expanded value of REG_EXPAND_SZ ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]