How to pass an Environment Variable to a Registry change? I have a REG with the following contents.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\MySoft\Options]
"ComputerName"="%computername%"

All I want to do is when I run the REG file, the %computername% variable be substituted to the *actual* value (name of the computer).

 This cannot be accomplished using a REG file, but this VBScript will do the trick. Copy the lines to Notepad, and save it with a .VBS extension. Run the file.

Set WshShell = CreateObject("Wscript.Shell")
sValue = WshShell.ExpandEnvironmentStrings _
    ("%computername%")
sKey = "HKCU\Software\MySoft\Options\"
WshShell.RegWrite sKey & "ComputerName", sValue, "REG_SZ"
Set WshShell = Nothing