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
  • Hub Transport 1
    Hub Transport Server: Resolving ‘Failed to Reach Running Status’ Network | Monitoring
  • Safeguard Your PC Against Common Malware Entry Points
    Safeguard Your PC Against Common Malware Entry Points Security | Vulnerability Scans and Assessment
  • BitLocker MBAM Frequently Asked Questions
    Disable the Sleep Mode: UEFI and TPM and BitLocker FAQs Windows
  • Configure Data Deduplication on Windows Server
    Video on how to Configure Data Deduplication on Windows Server Windows Server
  • homebrew social card
    Package Manager for macOS: How to install Homebrew on macOS Mac
  • linux windows 10
    Windows Subsystem for Linux: How to install WSL on Windows 10 Linux
  • Hide or Show User Accounts from Login Screen on Windows 10 and 11
    How to Hide or Show User Accounts from Login Screen on Windows 10 and 11 Windows
  • How to Hide or Fix HP Printer Updates Windows Error 0x800f020b
    Hide Windows Updates: How to Hide or Fix HP Printer Windows Updates Error 0x800f020b Windows

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 Pocket (Opens in new window) Pocket
  • 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

  • image 1
    How to Enable the End Task Option on Windows 11 Taskbar Windows
  • microsoft edge
    All available Policies for the latest version of Microsoft Edge Windows
  • Capture 37
    How to Configure Network Load Balancing on Windows Server Backup
  • Windows 11 default Icons
    Windows Desktop Icon: How to Make Default System Icons Visible Windows
  • Startup delay mbam
    Force immediate MBAM Encryption: Why does the MBAM Agent delay most times in encrypting devices? Windows
  • WIinG
    Capture and Record your Screen in Windows 10 with Xbox Game Bar Windows

More Related Articles

image 1 How to Enable the End Task Option on Windows 11 Taskbar Windows
microsoft edge All available Policies for the latest version of Microsoft Edge Windows
Capture 37 How to Configure Network Load Balancing on Windows Server Backup
Windows 11 default Icons Windows Desktop Icon: How to Make Default System Icons Visible Windows
Startup delay mbam Force immediate MBAM Encryption: Why does the MBAM Agent delay most times in encrypting devices? Windows
WIinG Capture and Record your Screen in Windows 10 with Xbox Game Bar Windows

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

sysadmin top30a

  • Hub Transport 1
    Hub Transport Server: Resolving ‘Failed to Reach Running Status’ Network | Monitoring
  • Safeguard Your PC Against Common Malware Entry Points
    Safeguard Your PC Against Common Malware Entry Points Security | Vulnerability Scans and Assessment
  • BitLocker MBAM Frequently Asked Questions
    Disable the Sleep Mode: UEFI and TPM and BitLocker FAQs Windows
  • Configure Data Deduplication on Windows Server
    Video on how to Configure Data Deduplication on Windows Server Windows Server
  • homebrew social card
    Package Manager for macOS: How to install Homebrew on macOS Mac
  • linux windows 10
    Windows Subsystem for Linux: How to install WSL on Windows 10 Linux
  • Hide or Show User Accounts from Login Screen on Windows 10 and 11
    How to Hide or Show User Accounts from Login Screen on Windows 10 and 11 Windows
  • How to Hide or Fix HP Printer Updates Windows Error 0x800f020b
    Hide Windows Updates: How to Hide or Fix HP Printer Windows Updates Error 0x800f020b Windows

Subscribe to Blog via Email

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

Join 1,832 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

AWS 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.