Creating registry key with expandable string value named (Default)?
You can't do it using RegEdit. (or at least I don't think that you can!)..
Use the reg.exe command line to pull it off.
reg.exe add <key_name> /ve /t REG_EXPAND_SZ /d "%path%"
(for instance).
For the record, other ways to create a (Default)
value of type REG_EXPAND_SZ
:
-
If you prefer creating keys/values directly in
RegEdit
, Which makes string values with embedded quotes and slashes much easier to compose, you can then letRegedit
do the work of escaping special characters and encoding unicode strings. To create a(Default)
value of typeREG_EXPAND_SZ
:- Create the key.
- Create a value named
temp
of typeREG_EXPAND_SZ
with the value you want for(Default)
. - Export to a .reg file.
- Edit the file, cutting
"temp"
to the clipbard then replacing with@
. then, add a new line, pasting"temp"
followed by=-
. - Save and merge.
Registry Export:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\DummySoftware\Path]
"temp"=hex(2):25,00,55,00,73,00,65,00,72,00,50,00,72,00,6f,00,66,00,69,00,6c,\
00,65,00,25,00,5c,00,44,00,75,00,6d,00,6d,00,79,00,53,00,6f,00,66,00,74,00,\
57,00,61,00,72,00,65,00,00,00
After editing:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\DummySoftware\Path]
@=hex(2):25,00,55,00,73,00,65,00,72,00,50,00,72,00,6f,00,66,00,69,00,6c,\
00,65,00,25,00,5c,00,44,00,75,00,6d,00,6d,00,79,00,53,00,6f,00,66,00,74,00,\
57,00,61,00,72,00,65,00,00,00
"temp"=-
After merging:
-
PowerShell is also an option.
$Splat = @{ 'Path' = 'HKCR:\SOFTWARE\DummySoftware2\Path' 'Value = '%UserProfile%\DummySoftware2' 'ItemType' = 'ExpandString' 'Force' = $False } New-Item $Splat