Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Windows » How to add and modify the Windows Registry from the Command Prompt

How to add and modify the Windows Registry from the Command Prompt

Posted on 01/04/202304/06/2023 Matthew By Matthew No Comments on How to add and modify the Windows Registry from the Command Prompt
Using-the-Command-Prompt-to-add-and-modify-the-Windows-registry
Using the Command Prompt to add and modify the Windows registry

The Windows Registry is a critical component of the Windows operating system that contains several configuration settings. It’s a tree-structured database that stores all the configuration data for your system, including hardware specs, software versions, user preferences, and more. Both the Windows Registry Editor and the Command Prompt can be used to access and edit the Registry. If you’re a system administrator and you want to automate processes, make changes in bulk, or just prefer the command line over a graphical user interface, this might be helpful for you. The Command Prompt’s ability to create and edit entries in the Windows Registry is useful in this setting. Registry keys and values can be added, modified, deleted, exported, and imported using the Command Prompt.

Modifying the registry, however, is a delicate procedure that might cause damage to your system if you aren’t careful. To effectively manage the registry, it is crucial to be familiar with its structure and the command-line tools at your disposal. It’s also a good idea to make a copy of the registry before making any changes, just in case. Learn more about this fix: Can’t connect via RDP upon installing Norton 360, and How to Fix “Getting Windows Ready” don’t turn off your computer stuck on Windows.

To see a list of operations and what each does, visit the Microsoft website. Kindly refer to these related guides: How To Scan WordPress websites With WPScan For Security Vulnerabilities, and How to Fix OneDrive Error 0x80071129: The tag present in the reparse point buffer is invalid.

Adding a new key to the Windows Registry from the Command Prompt

Here’s how to use the Command Prompt to add a new key to the Windows Registry. Press the Windows key to open Start, search for CMD and run as administrator.

Add and modify the Windows Registry from the Command Prompt: 1_Run-Command-Prompt
Open Command Prompt as Administrator

Type “reg add” and the key path you want to create, in the format “HKEY_LOCAL_MACHINE\Key\SubKey” For example, if you want to create a new key called “MyKey” under “HKEY_LOCAL_MACHINE\Software” type:

reg add HKEY_LOCAL_MACHINE\Software\MyKey
Add and modify the Windows Registry from the Command Prompt: 1_Adding-registry-key
Adding registry key

Press Enter to add the new key to the Windows Registry. Here are some exciting guides. Error 1064: An exception occurred in the service when handling the control request. How to export MySQL database via command line in Linux, and Restoring a Backup: How to import a MySQL Database through the command line interface.

Adding a new value to a Windows Registry key from the Command Prompt

Follow these instructions to assign a new value to a Windows Registry key through the command prompt. Press the Windows key to open Start, search for CMD and run as administrator.

Add and modify the Windows Registry from the Command Prompt: 1_Run-Command-Prompt
Open Command Prompt as Administrator

Type “reg add” followed by the key path in the format “HKEY_LOCAL_MACHINE\Key\SubKey” where you wish to add the value. To add a new value named “MyValue” to the key named “MyKey” that you just created, the command would look like this:

reg add HKEY_LOCAL_MACHINE\Software\MyKey /v MyValue /t REG_SZ /d "TechDirectArchive"
2_Adding-new-value-to-registry
Adding new value to registry

The “/v” specifies the name of the value, “/t” the type of the value, and “/d” the data associated with the value in this command. The text “TechDirectArchive” will be stored in a new string value with the name “MyValue” in this example.

Press Enter to add the new value to the Windows Registry key.

Using the command prompt to modify an existing Windows Registry value

Using the Command Prompt, you can make the following changes to an existing value in the Windows Registry:

Press the Windows key to open Start, search for CMD and run as administrator.

1_Run-Command-Prompt
Open Command Prompt as Administrator

Type “reg add” followed by the key path in the format “HKEY_LOCAL_MACHINE\Key\SubKey” to specify the location of the value. To edit the value labeled “MyValue” under the key “MyKey” that you just generated, the corresponding command would be:

reg add HKEY_LOCAL_MACHINE\Software\MyKey /v MyValue /t REG_SZ /d "Welcome to TechDirectArchive"

You will be prompted to overwrite the existing value in the registry location, press Y and hit Enter to confirm.

3_Modifying-existing-Windows-registry
Modifying an existing Windows registry

By entering this command, we are instructing the computer to replace the text “TechDirectArchive” with “Welcome to TechDirectArchive” in the “MyValue” variable.

4_windows-registry
Windows Registry Editor

You can see the changes we have made in the registry editor.

Deleting a Windows Registry key or value from the Command Prompt

Using the Command Prompt, you can remove a key or value from the Windows Registry by doing the following:

1_Run-Command-Prompt
Open Command Prompt as Administrator

Press the Windows key to open Start, search for CMD and run as administrator.

The second step is to remove the key or value by entering “reg delete” and then the key path in the format “HKEY_LOCAL_MACHINE\Key\SubKey” for keys or “HKEY_LOCAL_MACHINE\Key\SubKey /v ValueName” for values. To remove the key named “MyKey” that you generated, you would use the following command:

reg delete HKEY_LOCAL_MACHINE\Software\MyKey /f
5_Delete-registry-key
Delete registry key

Here, /f forces the deletion of the key and all its subkeys without prompting for confirmation. Please see How to run the Cisco ASDM launcher, and informative guide on Linux basic commands.

I hope you find this helpful in adding and modifying registry keys through the Command Prompt. If you have any questions, please leave a comment in the comment section below.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Windows Tags:Microsoft Windows, Registry, Registry Keys, Windows 10, Windows 11, Windows Registry

Post navigation

Previous Post: How to Fix OneDrive Error 0x80071129: The tag present in the reparse point buffer is invalid
Next Post: How to uninstall WAMPServer from Windows

Related Posts

  • Screenshot 2020 06 25 at 23.38.40
    What is Registry Editor and how to access the registry hives Windows
  • cimInstance wmi
    How to fix Get-CimInstance Access PermissionDenied Windows
  • Enable only Windows Admin to shutdown PC
    Allow only Administrators to shut down and reboot Server Windows
  • ios microsoft remote desktop app
    Remote Desktop can not find the computer FQDN and this might mean that FQDN does not belong to the specified network Windows
  • banner 3
    How to Create a React App with Vite Version Control System
  • Featured image Windows Security
    How to clear Cache and Manually Update Microsoft Defender Anti-Virus Solution

More Related Articles

Screenshot 2020 06 25 at 23.38.40 What is Registry Editor and how to access the registry hives Windows
cimInstance wmi How to fix Get-CimInstance Access PermissionDenied Windows
Enable only Windows Admin to shutdown PC Allow only Administrators to shut down and reboot Server Windows
ios microsoft remote desktop app Remote Desktop can not find the computer FQDN and this might mean that FQDN does not belong to the specified network Windows
banner 3 How to Create a React App with Vite Version Control System
Featured image Windows Security How to clear Cache and Manually Update Microsoft Defender Anti-Virus Solution

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

Veeam Vanguard

  • scandium
    How to Test Web Applications Using Scandium Configuration Management Tool
  • How to configure Azure container register with secured connection with container apps
    Configure Azure Container Registry for a secure connection with Azure Container Apps AWS/Azure/OpenShift
  • Deploy to ACI
    Create Azure Container instance to deploy your image to Azure using Azure CLI AWS/Azure/OpenShift
  • azure logo 1
    How to use the built-in Azure Active Directory Connect tool AWS/Azure/OpenShift
  • connect to RDP automatically
    RDP Configuration Settings: Connect automatically to RDP session Windows
  • ssl
    SSL Encrypted Communications explained Web Server
  • 1 kajkbmlyehn0inifwrh 8w
    How to install Kerberos packages via Cygwin in Windows Windows Server
  • Storage Explorer
    How to Install Azure Storage Explorer on Windows AWS/Azure/OpenShift

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,821 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.