Windows users can access and edit the Windows registry through the command line. Review the sections below for the version of Windows on your computer and information about registry edit commands and syntax.

Microsoft Windows XP, Vista, 7, 8, 10, and 11 users

Microsoft Windows XP and later users can view, edit, and modify their registry from the Command Prompt application using the reg command. See the reg command page for additional information and examples.

If you’re attempting to edit the registry from the command line because you’re unable to get to normal Windows, try first booting to Windows Safe Mode. Then, run Regedit from Safe Mode.

To open Windows registry in the command prompt, press Windows key+R, type cmd, and press Enter. In the Command Prompt, type regedit and press Enter.

Microsoft Windows 95, 98, ME, and 2000 users

By default, Microsoft Windows 95, 98, ME, and 2000 users can import registry files from the command prompt using the Regedit command. Using this command and a registry file containing the proper commands, a user can add, remove, and otherwise edit the registry from the command line.

The instructions in this section also work for later versions of Microsoft Windows.

If you want to import a registry file from the command line, you can use the Regedit command and the name of the file you want to import. For example, if the name of the file was hope.reg, type the following command.

Regedit hope.reg

The file hope.reg could contain the commands necessary to add and remove registry values. Below are examples of registry files to create entries, delete single entries, and a complete folder. To create these files yourself, copy the following examples into an empty .reg file or use notepad or the edit command to create a file using the following commands.

The following example adds a ComputerHope folder into the HKEY_LOCAL_MACHINE\Software directory with a string example and data value of data here.

Users running earlier versions of Windows may want to substitute Windows Registry Editor Version 5.00 with REGEDIT4.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\ComputerHope] “example”=“data here”

To delete a single entry in the registry, add a hyphen (minus) key after the equal sign. For example, if we wanted to delete our string value “example” we created with the above example, we would create the following .reg file.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\ComputerHope] “example”=-

To delete the folder and all its continents, create a .reg file similar to the following example.

Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE\SOFTWARE\ComputerHope]

Regedit command syntax

REGEDIT [/L:system] [/R:user] [/C] [/R] [/E] [/S] [/C] FILE [registry_key]

  • Windows registry help and support.
  • See our registry definition for further information and related links.
  • Microsoft Windows help and support.