export reg_sz key registry in hex format

2

I need to export a registry key of type REG_SZ using hex format because it contains some non printable values (00 and 0a). So when I export it as .reg using regedit I can't get a correct file. Is there a simple way to export it in hex format?

I would get something like following example

[HKEY_CURRENT_USER\Mykey]
@=hex(1):31,00,73,00,74,00,20,00,4c,00,69,00,6e,00,65,00,0d,00,0a,00,00"

holap

Posted 2014-07-03T15:48:58.697

Reputation: 133

Answers

1

Instead of exporting using the UI or regedit /e, use reg save. It will save the values as a binary file, you can then re-import using the reg restore command. You need to do this in an elevated command prompt. Be aware that this also includes the keys permissions.

e.g.

reg save HKEY_CURRENT_USER\Mykey C:\Temp\SavedMyKey
reg restore HKEY_CURRENT_USER\Mykey C:\Temp\SavedMyKey

Patrick

Posted 2014-07-03T15:48:58.697

Reputation: 11