If you need to add a registry entry to a Windows PC most often techs will simply export the key and entries they want and then use the REGEDIT /S
command to push that entry onto another PC.
For example if you want to disable the Cortana bar (but not Windows Search), you save the following into a file named DISABLE-CORTANA.REG
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"AllowCortana"=dword:00000000
Then you simply put that file on one of your servers and push it out to your PC’s using something like:
regedit /s "\\<Your-Server>\<Your-Share>\Scripts\disable-cortana.reg"
REG ADD
command to make your change. For instance:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /t REG_DWORD /d 1 /f
The switches mean:
/v <ValueName> | Specifies the name of the registry entry to be added under the specified subkey. |
/ve | Specifies that the registry entry that is added to the registry has a null value. |
/t <Type> | Specifies the type for the registry entry. Type must be one of the following: REG_SZ REG_MULTI_SZ REG_DWORD_BIG_ENDIAN REG_DWORD REG_BINARY REG_DWORD_LITTLE_ENDIAN REG_LINK REG_FULL_RESOURCE_DESCRIPTOR REG_EXPAND_SZ |
/s <Separator> | Specifies the character to be used to separate multiple instances of data when the REG_MULTI_SZ data type is specified and more than one entry needs to be listed. If not specified, the default separator is \0. |
/d <Data> | Specifies the data for the new registry entry. |
/f | Adds the registry entry without prompting for confirmation. |
REG ADD HKCU\Software\SS64 /v Sample /d "some test data"
reg add HKEY_CURRENT_USER\Environment /v userpath /t REG_EXPAND_SZ /d C:\Windows
REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ea
reg add HKLM\Software\sav /v test /t REG_SZ /d "\"%userprofile%\""
Reg delete <KeyName> [{/v ValueName | /ve | /va}] [/f]
<KeyName> | Specifies the full path of the subkey or entry to be deleted. To specify a remote computer, include the computer name (in the format \\ComputerName) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer. The KeyName must include a valid root key. Valid root keys for the local computer are: HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, valid root keys are: HKLM and HKU. |
/v <ValueName> | Deletes a specific entry under the subkey. If no entry is specified, then all entries and subkeys under the subkey will be deleted. |
/ve | Specifies that only entries that have no value will be deleted. |
/va | Deletes all entries under the specified subkey. Subkeys under the specified subkey are not deleted. |
/f | Deletes the existing registry subkey or entry without asking for confirmation. |
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /f
This website uses cookies.
View Comments
Reg query and reg del to be use in script
http://winplat.in/2020/10/26/using-reg-command-line-tool-for-registry-operation/
After years of searching for a way to easily delete registry entries - I discovered RegScanner.
RegScanner by NirSoft is a small free utility that allows you to scan the Registry, find the desired Registry values that match to the specified search criteria, and display them in one list.
One of the best features of RegScanner is the ability to search for a keyword or value and create a REG file from the resulting list.
This comes in handy when you have multiple registry entries that refuse to delete. Many stubborn registry entries will delete when you create a REG file and replace all [HKEY values with [-HKEY before executing