I'm trying to put the %computername% variable as a value to a key in
the registry, but the application that uses that key inputs it as
%computername% in the application and not the actual computername.
Should you be able to use variables in the registry? I have looked
everywhere for this info. The closest I came is finding a link to a
freeware utility (REGENV) that supposedly does it, but the link was
dead.

I didn't know which forum to ask this question in. These types of
newsgroups seem to know more then your average windows newsgroup.
Thanks,

Scott

Re: passing a variable to the registry by Torgeir

Torgeir
Tue Jul 20 12:45:23 CDT 2004

scmills wrote:

> I'm trying to put the %computername% variable as a value to a key in
> the registry, but the application that uses that key inputs it as
> %computername% in the application and not the actual computername.
> Should you be able to use variables in the registry? I have looked
> everywhere for this info. The closest I came is finding a link to a
> freeware utility (REGENV) that supposedly does it, but the link was
> dead.
Hi

Most likely it will work if you create the value as type
REG_EXPAND_SZ instead of REG_SZ.

Environment variables in REG_EXPAND_SZ values are expanded by the
OS when those values are read.


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx