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
  • Screenshot 2021 03 16 at 21.14.05
    Unable to locate the account: Fix call to DsGetDcNameWithAccount failed with return value 0x0000054B Windows Server
  • Screenshot 2020 05 14 at 18.00.59
    Linux Error 13: Permission denied – Are you root Linux
  • nonexistent AD
    Fix Active Directory Domain Controller (AD DS) for this domain could not be contacted Windows Server
  • Featured image 1
    How to Change User Account Type in Windows 10 Windows
  • Embed Microsoft Forms into Your Website Page
    How to Embed Microsoft Forms into Your Website Page Microsoft Exchange/Office/365
  • images 1 1
    How To Use Pleasant Password Private Folder Password Manager
  • Azure App Service
    How to Restore Deleted Azure App Service Using PowerShell Automation
  • Edge
    Install Microsoft Edge Browser on Ubuntu Linux Linux

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

  • find my device banner
    Video on how to Enable Find My Device on Windows 11 Windows
  • mdm
    Delete AssignedAccess applied via MDM WMI bridge Provider Windows
  • image 35
    How to Activate and Press Ctrl+Alt+Del in Anydesk for Remote Access Connection to Windows system Windows
  • 5rgh65436
    New Windows 11 encryption features and security enhancements for Hybrid Work Security | Vulnerability Scans and Assessment
  • Screenshot 2020 06 25 at 22.51.15
    Why is Data recovery is almost impossible from an overwritten Hard Drive Windows
  • Featured image BitLocker AES XTX 256
    Enable BitLocker AES-XTX 256 Encryption Security | Vulnerability Scans and Assessment

More Related Articles

find my device banner Video on how to Enable Find My Device on Windows 11 Windows
mdm Delete AssignedAccess applied via MDM WMI bridge Provider Windows
image 35 How to Activate and Press Ctrl+Alt+Del in Anydesk for Remote Access Connection to Windows system Windows
5rgh65436 New Windows 11 encryption features and security enhancements for Hybrid Work Security | Vulnerability Scans and Assessment
Screenshot 2020 06 25 at 22.51.15 Why is Data recovery is almost impossible from an overwritten Hard Drive Windows
Featured image BitLocker AES XTX 256 Enable BitLocker AES-XTX 256 Encryption Security | Vulnerability Scans and Assessment

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

  • Screenshot 2021 03 16 at 21.14.05
    Unable to locate the account: Fix call to DsGetDcNameWithAccount failed with return value 0x0000054B Windows Server
  • Screenshot 2020 05 14 at 18.00.59
    Linux Error 13: Permission denied – Are you root Linux
  • nonexistent AD
    Fix Active Directory Domain Controller (AD DS) for this domain could not be contacted Windows Server
  • Featured image 1
    How to Change User Account Type in Windows 10 Windows
  • Embed Microsoft Forms into Your Website Page
    How to Embed Microsoft Forms into Your Website Page Microsoft Exchange/Office/365
  • images 1 1
    How To Use Pleasant Password Private Folder Password Manager
  • Azure App Service
    How to Restore Deleted Azure App Service Using PowerShell Automation
  • Edge
    Install Microsoft Edge Browser on Ubuntu Linux Linux

Subscribe to Blog via Email

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

Join 1,825 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.