DEV Community

Victor James
Victor James

Posted on • Originally published at windowscmd.com on

REGEDIT Command: Import/Exports Registry Settings

REGEDIT

REGEDIT

The REGEDIT ** windows command-line tool is to **import, export, or remove registry settings from a text. Let’s see about this command in detail with its syntax below.

CMD Line

CMD Line is a ** text-based interface** that transfers the command from the user to the OS.

CLI-Command Line Interpreter

The command-line interpreter (CLI) for windows is CMD.EXE. Also, you can use PowerShell, which can automate many system administration tasks and these tasks are not approachable in command prompt. With the help of the CLI, you can communicate with your system by typing the text in commands. As a result, your system answers to the text that you have typed previously, and then the user can proceed with the following command line that shows up.

To open the Run command Window.

*Run command window * helps you to run programs, open the files and folders. And there are several ways to open up the run command dialogue box. This run command box is helpful for you to head straight to the destined program quickly.

By using the Keyboard shortcut Key:

WINDOWS+R

The shortcut key method to the run command box is the most commonly used one. Also, this method is in all versions of Windows. It would help if you pressed the Windows+ R ** ** key concurrently to open the Run command dialogue box.

Run command box
Run command box

What does the REGEDIT command do?

The REGEDIT windows command-line tool is to import and export registry settings. The job of this command-line tool is to import, export, or else remove registry settings from a text.

Syntax

  • Code to Export the Registry

REGEDIT /E pathname

Enter fullscreen mode Exit fullscreen mode
  • Export Part of the Registry

REGEDIT /E pathname "RegPath"

Enter fullscreen mode Exit fullscreen mode
  • Code to Export part of the Registry in ANSI mode

REGEDIT /A pathname "RegPath"

Enter fullscreen mode Exit fullscreen mode
  • Code to Import a reg script

REGEDIT pathname

Enter fullscreen mode Exit fullscreen mode
  • For silent import

REGEDIT /S pathname

Enter fullscreen mode Exit fullscreen mode
  • Code to start the regedit GUI

REGEDIT 

Enter fullscreen mode Exit fullscreen mode
  • Code to Open multiple copies of regedit

REGEDIT /m

Enter fullscreen mode Exit fullscreen mode

Parameter Explanation

  • /E – For Export
  • /S – This key is to Silent Import

If you execute this command on the command prompt, the output will be as

REGEDIT
REGEDIT

Adding Values to the Registry

  • To add values to the registry , create a text like

Windows Registry Editor Version 5.00 

[HKEY_CURRENT_USER\SomeKey]
"SomeStringValue"="Hello"

Enter fullscreen mode Exit fullscreen mode

Note : The registry file name should be in full form and not in short form like (HKLM, HKCU). While double-clicking this particular file, we will add the registry key, or else you can execute Myfile.REG from the command line.

Deleting values from the Registry

  • To delete a value from the registry, First, create a reg file like

Windows Registry Editor Version 5.00 
[-HKEY_CURRENT_USER\SomeKey] 

Enter fullscreen mode Exit fullscreen mode
  • Look for the hyphen ** inside the first bracket. While **double-clicking, some keys will be deleted alongside the values and all. If you want ** only the values** removed , set the value that you want to delete here. We want to delete the hyphen.

For Instance


Windows Registry Editor Version 5.00 
[HKEY_CURRENT_USER\SomeKey]
"SomeStringValue"=-

Enter fullscreen mode Exit fullscreen mode

By double-clicking , you can delete the value.

Elevated Permissions.

Elevated permissions are needed for the Regedit, while adding items in HKCU permissions is required. After that, REGEDIT will permit you to utilize the whole registry.

Exporting Registry key to a text

  • To export the registry key to a text file

regedit /e export.reg HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Audio

Enter fullscreen mode Exit fullscreen mode
  • In ANSI text format

regedit /A ansi.reg HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Audio

Enter fullscreen mode Exit fullscreen mode

Comparing

By opening several copies of Regedit.exe, you can ** compare keys between two registries** or between two computers.

Drag and Drop

Drag and drop can be utilized when connected to a remote registry , allowing you to apply a .reg file to a remote machine.

Adding Comments

Comments are prefixed with a semicolon within a registry file

For instance,


;
; Turn the NUMLOCK on at login
;
[HKEY_CURRENT_USER\Control Panel\Keyboard]
"InitialKeyboardIndicators"="2"

Enter fullscreen mode Exit fullscreen mode

Note : Batch files do not consider ** semicolons** to be utilized in a self-contained registry script.

Verdict

In this guide, we have stated the REGEDIT windows command-line tool with its syntax and examples. If you have any suggestions or questions regarding this article, let us know in the comment section, we will update it to you shortly.

Related Articles

The post REGEDIT Command: Import/Exports Registry Settings appeared first on Windows Commands- SS64 Commands.

Discussion (0)