here is a (just) example:
reg add HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics /v MessageFont /t REG_BINARY /d "hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\ 00,00,00,01,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00" /f
it doesn't work.
Many thanks in advance.
(btw, which code tags should be used here?)
EDIT: Sorry for the delay (i haven't got a reply here for several days, so i was googling and trying to find solution by myself) and thank you for the reply.
I solved the issue by removing "hex" and commas. Binary values should be added as a long row of numeric characters w/o spaces and commas.
Now i have another problem. How can i change just the value of an entry using reg command? For instance i should change the value of 'Default' registry entry from something to 'value not set' or vice versa. If i use 'reg add' command for that, it adds another entry with the same name instead of changing the value of the existing one. I can't use 'delete the old one and add a new one' technique, because it's not possible to delete 'Default' entry.
I need to do that through a batch file not reg file. (but anyway it would be good to know how could it be accomplished by reg file as well)
EDIT2: the solution for deletion of a value of a Default entry: reg delete HKLM...\Key /ve /f
for modifying entry values regini should be used. http://support.microsoft.com/kb/264584 (explanation in this page is a bit vague and maybe even inaccurate) put in a batch file: regini c:\testregini.txt where testregini.txt contains: HKEY_LOCAL_MACHINE...\Key EntryXY = somevalue ( or "value not set", or whatever of that data type)
How do I check if a key is present in the windows registry. This can be done using reg query key : This command will set %errorlevel% . errorlevel=0 means the key exists.
Use the GetValue method, specifying the path and name) to read a value from registry key. The following example reads the value Name from HKEY_CURRENT_USER\Software\MyApp and displays it in a message box.
simple as that:
reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v MessageFont /t REG_BINARY /d f5ffffff0000000000000000000000009001000000000001000000005400610068006f006d00610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 /f
That's it! I' just wondering why this was of no interest to anyone here before.
I'm not sure how to do it in a regular batch file, but here's how you can do it using PowerShell, using an example of setting the failure actions for the ASP.NET State service:
Let's say that this is what an export of your value looks like:
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\aspnet_state]
"FailureActions"=hex:50,33,01,00,00,00,00,00,00,00,00,00,03,00,00,00,0e,00,00,\
00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00
You put the hex values into a byte array and then use that value to set the registry value:
$failureActionsValue = ([byte[]](80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00))
Set-ItemProperty -Path 'HKLM:\System\ControlSet001\services\aspnet_state' -Name "FailureActions"
-Value $failureActionsValue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With