Post by drcard on Jan 31, 2024 14:56:28 GMT -5
Most users I help do not feel confident enough to directly edit the Registry and rely on .reg file from a trusted source and the Merge process to add that change to their Registry. Because of the pop up warning when merging a .reg file and other warnings that editing the registry can “destroy you PC and make it stop working” some users won’t use the merge process and result in not getting the Registry change they need.
I developed the following method to allow these users to apply the Registry change easily without any warning windows popping up to scare them.
I post this method for those that help such users.
Add a Registry Value With a .bat File
What
Instructions on how to use a .bat file to add/change a Registry key value.
Why
When situations arise where the solution is the addition or change of a Registry key. For many users, directly adding or editing a Registry key is not an option so generous, more knowledgeable people post the Registry change as a .reg file. This is better than having to work directly in the Registry, but the Merge process with warning windows that pop up and other confirmation windows before the process is completed is still scary to a lot of users and some users do not install the Registry change due to fear of these standard warnings. If the Registry change is placed in a .bat file, the user will not see any warning message and requires only one confirmation click.
How
o A Registry key, value, and data can entered into the Registry using the REG ADD command. A command can be ran by a .bat file. Thus a .bat file can be used to make a Registry addition.
o The REG ADD syntax is long and includes options not needed for a single value key, so the syntax below displays only the options needed for single value entries.
REG ADD <keyname> [/v valuename] [/t datatype] [/d data] [/f]
o To explain how to turn that .reg file to a .bat file, the example I will use is the Registry key that controls how Outlook opens – Online or Offline
o The Registry key (keyname) is:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046
o The Value for that key (valuename) is:
00030398
o The Data Type for that Value (datatype) is
REG_BINARY
Note: The Data Type is displayed for that Value in the view pane of the Registry for that key.
o The data (hex) for the Value is:
01000000 To open Outlook Offline
or
02000000 To open Outlook Online
o The command to add the Offline key is:
REG ADD HKCU\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046 /v 00030398 /t REG_BINARY /d 01000000 /f
Although it covers several lines in this document due to text warping, it is a one line command.
o Pasting that one line command into a blank Notepad document and naming with a .bat extension creates the .bat file.
o The same .reg file for this Registry change is:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046]
"00030398"=hex:01,00,00,00
o Note the differences:
Command does not need to use the Registry Editor and does not nee the “Windows Registry Editor Version 5.00” identifier.
Command uses only abbreviated hive identification (HKCU instead of HKEY_CURRENT_USER)
Command does not place the Value in quotes.
The .reg file places the Value, data type, and data on a separate line and presented in a different format than viewed in the Registry.
o Both of the files above will change that Registry key.
o Merging the .reg causes a pop up window asking permission to use the Registry Editor which has to be answered, a second confirmation window acknowledging the dangers of editing the Registry which must answered, and finally click to close the third window stating that the key had been added.
o Running the .bat file you select Run as an administrator which causes a pop up window asking permission to use the Command Processor which must be answered and no other actions, warning, or windows will occur. Only one window to confirm for the whole process.
I developed the following method to allow these users to apply the Registry change easily without any warning windows popping up to scare them.
I post this method for those that help such users.
Add a Registry Value With a .bat File
What
Instructions on how to use a .bat file to add/change a Registry key value.
Why
When situations arise where the solution is the addition or change of a Registry key. For many users, directly adding or editing a Registry key is not an option so generous, more knowledgeable people post the Registry change as a .reg file. This is better than having to work directly in the Registry, but the Merge process with warning windows that pop up and other confirmation windows before the process is completed is still scary to a lot of users and some users do not install the Registry change due to fear of these standard warnings. If the Registry change is placed in a .bat file, the user will not see any warning message and requires only one confirmation click.
How
o A Registry key, value, and data can entered into the Registry using the REG ADD command. A command can be ran by a .bat file. Thus a .bat file can be used to make a Registry addition.
o The REG ADD syntax is long and includes options not needed for a single value key, so the syntax below displays only the options needed for single value entries.
REG ADD <keyname> [/v valuename] [/t datatype] [/d data] [/f]
o To explain how to turn that .reg file to a .bat file, the example I will use is the Registry key that controls how Outlook opens – Online or Offline
o The Registry key (keyname) is:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046
o The Value for that key (valuename) is:
00030398
o The Data Type for that Value (datatype) is
REG_BINARY
Note: The Data Type is displayed for that Value in the view pane of the Registry for that key.
o The data (hex) for the Value is:
01000000 To open Outlook Offline
or
02000000 To open Outlook Online
o The command to add the Offline key is:
REG ADD HKCU\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046 /v 00030398 /t REG_BINARY /d 01000000 /f
Although it covers several lines in this document due to text warping, it is a one line command.
o Pasting that one line command into a blank Notepad document and naming with a .bat extension creates the .bat file.
o The same .reg file for this Registry change is:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles\Outlook\0a0d020000000000c000000000000046]
"00030398"=hex:01,00,00,00
o Note the differences:
Command does not need to use the Registry Editor and does not nee the “Windows Registry Editor Version 5.00” identifier.
Command uses only abbreviated hive identification (HKCU instead of HKEY_CURRENT_USER)
Command does not place the Value in quotes.
The .reg file places the Value, data type, and data on a separate line and presented in a different format than viewed in the Registry.
o Both of the files above will change that Registry key.
o Merging the .reg causes a pop up window asking permission to use the Registry Editor which has to be answered, a second confirmation window acknowledging the dangers of editing the Registry which must answered, and finally click to close the third window stating that the key had been added.
o Running the .bat file you select Run as an administrator which causes a pop up window asking permission to use the Command Processor which must be answered and no other actions, warning, or windows will occur. Only one window to confirm for the whole process.