Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Add or Delete Registry Key and Entry using Command Prompt

November 12, 2022
in Blog
0
ADVERTISEMENT

Table of Contents

The registry editor beholds a slew of crucial data files and configuration settings related to various OS components as well as user and system apps.

In this post, we will show you the steps to add or delete registry keys and values using Command Prompt.

Before you begin, let’s take a look about the root keys otherwise known as:

  • HKEY_CLASSES_ROOT = HKCR
  • HKEY_CURRENT_USER = HKCU
  • HKEY_LOCAL_MACHINE = HKLM
  • HKEY_USERS = HKU
  • HKEY_CURRENT_CONFIG = HKCC

So, instead of HKEY_LOCAL_MACHINE, you will have to use it short form HKLM.

The Syntax

reg add <keyname> [{/v valuename | /ve}] [/t datatype] [/s separator] [/d data] [/f]
Note Note: If the registry key name, value name and data contains a space, enclose the key name in quotes.
Note Note: /ve Specifies that the added registry entry has a null value.

Here’s the list of all the datatype that you could refer to and use the one that corresponds to your registry file type.

  • 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

How to Add a Key or Subkey using Command Prompt

The parent key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google

For example, we want to add a subkey named DriveFS inside the parent key. So, we ran below command:

reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /f

To delete the subkey, we use the reg delete command:

reg delete "HKLM\SOFTWARE\Policies\Google\DriveFS" /f

How to add a Registry entry using Command Prompt

Once the subkey was created, we will create a new DWORD (32-bit) entry named Show and assign it 1 as its Value Data to enable it.

reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /v "Show" /t REG_DWORD /d "1" /f

To delete a Registry entry, run reg detete command. for example, we’ll delete the above DWORD value entry:

reg delete "HKLM\SOFTWARE\Policies\Google\DriveFS" /v "Show" /f

We can run the following command to create a String Value (REG_SZ):

reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /v "MountPoint" /t REG_SZ /d "C:\GDrive" /f
To edit the Default entry in a key, you must run reg add command wit switch and don’t need to specify the value name into the command.
reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /ve /d "100" /f

How to add a Registry entry using batch file

In some cases, you want to add or delete Registry keys or entries automatically instead of executing the commands manually. To achieve that goal, you need create a batch file.

For example, we’ll create a batch file then put all commands into it at once.

reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /f
reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /v "Show" /t REG_DWORD /d "1" /f
reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /v "MountPoint" /t REG_SZ /d "C:\GDrive" /f
reg add "HKLM\SOFTWARE\Policies\Google\DriveFS" /ve /d "100" /f
ADVERTISEMENT
5/5 - (1 vote)
Previous Post

How to Add Open with Notepad Option to the Right-Click Context Menu

Next Post

How to Enable or Show the Developer Menu in Microsoft Word?

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory