- Description of the Windows Registry Checker Tool (Scanreg.exe)
- Summary
- More Information
- To Restore Individual Files
- Known Issues for Windows Registry Checker
- References
- How to edit the Registry using Command Prompt on Windows 10
- How to edit the Registry using Command Prompt
- How to add and delete registry entries
- Syntax
- Command description
- REG ADD examples
- REG DELETE examples
- How to copy registry entries
- Syntax
- Command description
- REG COPY examples
- How to export and import registry entries
- Syntax
- Command description
- REG EXPORT examples
- REG IMPORT examples
- How to save and restore registry entries
- Syntax
- Command description
- REG SAVE examples
- REG RESTORE examples
- Wrapping things up
- More Windows 10 resources
- Halo: MCC’s live service elements make it better, not worse
- Microsoft’s Surface Duo is not ‘failing up’
- Here’s what you can do if Windows 10 update KB5001330 is causing issues
- These are the best PC sticks when you’re on the move
Description of the Windows Registry Checker Tool (Scanreg.exe)
Summary
When you start your computer successfully, the Windows Registry Checker tool (Scanreg.exe) creates a backup of system files and registry configuration information (including user account information, protocol bindings, software program settings, and user preferences) once daily. Files that Windows Registry Checker backs up include System.dat, User.dat, System.ini, and Win.ini. This article describes the Windows Registry Checker tool.
More Information
Windows Registry Checker automatically scans the system registry for invalid entries and empty data blocks when it is started. If invalid registry entries are detected, Windows Registry Checker automatically restores a previous day’s backup. This is equivalent to running the scanreg /autorun command from a command prompt. If no backups are available, Windows Registry Checker tries to make repairs to the registry. This is equivalent to running the scanreg /fix command from a command prompt. If the registry contains more than 500 KB of empty data blocks, Windows Registry Checker automatically optimizes it.
Windows Setup runs the Windows Registry Checker tool to verify the integrity of the existing registry before it performs an upgrade. If it detects registry damage, it tries to fix it automatically.
The protected-mode version of the Windows Registry Checker tool (Scanregw.exe) can create a backup of the system files and scan the registry for invalid entries. If invalid entries are detected, it refers to the real-mode version of the Windows Registry Checker tool (Scanreg.exe) for a resolution.
You can configure Windows Registry Checker with a Scanreg.ini file. Settings that you can configure include:
Enabling or disabling the tool
The number of backups maintained (no more than five is recommended)
The location of the backup folder
Settings to add additional files to the backup set
For additional information about the Scanreg.ini file, click the article number below to view the article in the Microsoft Knowledge Base:
183603 How to Customize Registry Checker Tool Settings To start the Windows Registry Checker tool, click Start, click Run, type scanregw.exe in the Open box, and then click OK.
NOTE: To use the Windows Registry Checker tool with the /restore parameter, you must run the tool from a command prompt running outside of Windows. When you do so, you can choose up to five registry backup files listed for you to restore.
To Restore Individual Files
To restore individual files, follow these steps:
Click Start, point to Find, and then click Files Or Folders.
In the Named box, type rb0*.cab, and then click Find Now.
Double-click the cabinet file that contains the file that you want to restore.
Right-click the file that you want to restore, click Extract, and then choose the folder where the new file is to be placed. Microsoft recommends that you place the file in your Temp folder.
Restart your computer in MS-DOS mode (in Windows Millennium Edition, this requires that you restart with the Windows Millennium Edition Startup disk).
Copy the file that you extracted to the appropriate folder. Note that registry .dat files are typically marked as hidden and read-only, so you need to use both the attrib and copy commands to replace the existing file with the newly extracted one.
Known Issues for Windows Registry Checker
If your registry contains an entry that references a file (such as a .vxd file) that no longer exists, it is not repaired by Windows Registry Checker. Such errors are not typically damaging, and you can manually remove the entry.
The amount of conventional memory that is required by Windows Registry Checker is determined by the size of your registry. Windows Registry Checker may require 580 KB or more of free conventional memory to complete the repair process. If you encounter an «Out of Memory» error message, optimize your free conventional memory.
NOTE: Extended memory is required for Windows Registry Checker to operate properly, so it does not run when you start your computer with the Safe Mode Command Prompt Only option. The exception to this is the scanreg /restore command, which is the only Scanreg function that can run without extended memory memory.
References
For additional information about Registry Checker command line switches, click the article number below to view the article in the Microsoft Knowledge Base:
184023 Command-Line Switches for the Registry Checker Tool
How to edit the Registry using Command Prompt on Windows 10
The Registry is a big part of Windows. It’s the database that stores the most important settings that help the operating system and certain applications to work.
You typically use the «Registry Editor» to modify the database when you need to fix an issue, enable a secret feature, or improve a particular functionality. However, you probably may not know that Windows 10, similar to previous versions, includes reg.exe, which is a command-line tool that allows you also to edit the Registry using Command Prompt.
Reg.exe comes built into the operating system, and it includes the same functionalities found in the Registry Editor (GUI). You can even edit entries faster, as you don’t have to manually browse the confusing tree database. And you get the flexibility of being able to implement tweaks in the Registry using scripts.
In this Windows 10 guide, we’ll walk you through the steps to get started using Reg.exe to edit the Registry using Command Prompt.
How to edit the Registry using Command Prompt
Important: If you’re planning to use these commands on your computer, make sure to understand that modifying the Registry is risky, and it can cause irreversible damage to your installation if you don’t do it correctly. It’s recommended to make a full backup of your computer before proceeding.
To run reg.exe, you first need to start Command Prompt as an administrator with the following steps:
- Open Start.
- Search for Command Prompt.
- Right-click the result and select Run as administrator.
To run the tool, type the following command and press Enter:
This command will display all the operation types you can use, including:
- REG Query
- REG Add
- REG Delete
- REG Copy
- REG Save
- REG Load
- REG Unload
- REG Restore
- REG Compare
- REG Export
- REG Import
- REG Flags
Note: You can also use REG followed by the operation type and /? to get more help. For example, REG QUERY /? or REG ADD /?.
You’ll also get the return codes: 0 meaning that the operation completed successfully, and 1 indicating that the operation failed. However, you won’t get any return codes using the Compare switch.
While there a long list of possible command combinations, below we’ll be listing the most useful commands to get started using reg.exe with Command Prompt.
How to add and delete registry entries
Syntax
- Add: REG ADD KeyName [] [/t Type] [/f]
- Delete: REG DELETE KeyName [] [/f]
Command description
- KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you’re trying to edit the registry on a remote computer, you can only use these shortcuts: HKLM and HKU.
- /v ValueName: Specifies the name for the registry key to be added or deleted.
- /ve: Defines if you’re adding or deleting an entry that has a null value.
/t Type: Specifies the type of registry entries. Here’s the list of valid types:
- 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
REG ADD examples
To add a subkey named MySubkey under HKEY_LOCAL_MACHINE\Software, use the following example:
REG ADD HKLM\Software\MySubkey
To add a new DWORD (32-bit) value entry named AppInfo with the value of 1, use the following example:
REG ADD HKLM\Software\MySubkey /v AppInfo /t REG_DWORD /d 1
To add a new DWORD (32-bit) value entry named AppInfo with value of 1 on a remote computer, use the following example:
REG ADD \\ComputerName\HKLM\Software\MySubkey /v AppInfo /t REG_DWORD /d 1
To add a new Binary Value entry named Data with data of fe340ead, use the following example:
REG ADD HKLM\Software\MySubkey /v Data /t REG_BINARY /d fe340ead
To add a registry entry with multiple values to MySubkey with a value name of MRU of type REG_MULTI_SZ and data of fax\0mail\2\1, use the following example:
REG ADD HKLM\Software\MySubkey /v MRU /t REG_MULTI_SZ /d fax\0mail\2\1
To add an expanded registry entry to MySubkey with a value name of Path of type REG_EXPAND_SZ and data of %systemroot%, use the following example:
REG ADD HKLM\Software\MySubkey /v Path /t REG_EXPAND_SZ /d ^%systemroot^%
REG DELETE examples
To delete the subkey named MySubkey, use the following example:
REG DELETE HKLM\Software\MySubkey /f
To delete the subkey named MySubkey on a remote computer, use the following example:
REG DELETE \\ComputerName\HKLM\Software\MySubkey /f
To delete the registry entry named AppInfo within the MySubkey subkey, use the following example:
REG DELETE HKLM\Software\MySubkey /v AppInfo /f
To delete only the registry entries that have no value inside the subkey named MySubkey, use the following example:
REG DELETE HKLM\Software\MySubkey /ve
To delete all the registry entries from the MySubkey subkey, use the following example:
REG DELETE HKLM\Software\MySubkey /va
How to copy registry entries
Syntax
- Copy: REG COPY KeyName1 KeyName2 [/s] [/f]
Command description
- KeyName1: Defines the path to the subkey you want to copy. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you’re trying to copy the registry on a remote computer, you can only use these shortcuts: HKLM and HKU.
- KeyName2: Defines the path to the subkey destination. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you’re trying to copy the registry on a remote computer, you can only use these shortcuts: HKLM and HKU.
- /s: Copies all subkeys and entries of a particular subkey.
- /f: Executes the copy command without prompting for confirmation.
REG COPY examples
To copy all subkeys and values under the key MySubkey1 to the key MySubkey2, use the following example:
REG COPY HKLM\Software\MySubkey1 HKLM\Software\MySubkey2 /s
To copy all values under the subkey MySubkey1 from a remote computer to the subkey MySubkey2 on the a new computer, use the following example:
REG COPY \\ComputerName\HKLM\Software\MySubkey1 HKLM\Software\MySubkey2
How to export and import registry entries
Syntax
- Export: REG EXPORT KeyName FileName [/y]
- Import: REG IMPORT FileName
Command description
- KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC.
- FileName: Specifies the name and path of the .reg file to be exported or imported.
- /y: Overwrites the registry content without prompting for confirmation.
REG EXPORT examples
To export all the content within the subkey MySubkey, use the following example:
REG EXPORT HKLM\Software\MySubkey C:\RegKeyBackup.reg
To export and overwrite any existing file, use the following example:
REG EXPORT HKLM\Software\MySubkey C:\RegKeyBackup.reg /y
REG IMPORT examples
To import all the content, including subkeys, entries, and values within the subkey named MySubkey, use the following example:
REG IMPORT C:\RegKeyBackup.reg
How to save and restore registry entries
Syntax
- Save: REG SAVE KeyName FileName [/y]
- Restore: REG RESTORE KeyName FileName
Command description
- KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you’re trying to edit the registry on a remote computer, you can only use these shortcuts: HKLM and HKU.
- FileName: Specifies the name and path of the .hiv file to be saved or restored.
- /y: Overwrites the registry content without prompting for confirmation.
REG SAVE examples
To save a copy of subkeys, entries, and values within the subkey named MySubkey, use the following example:
REG SAVE HKLM\Software\MySubkey C:\RegKeyBackup.hiv
To save and overwrite any existing file, use the following example:
REG SAVE HKLM\Software\MySubkey C:\RegKeyBackup.hiv /y
REG RESTORE examples
To restore all the content, including subkeys, entries, and values within the subkey named MySubkey, use the following example:
REG RESTORE HKLM\Software\MySubkey C:\RegKeyBackup.hiv
Wrapping things up
While you can always use the Registry Editor, you’ll find that it’s sometimes easier and faster to use the reg.exe command-line tool. However, at the end of the day, you will still be editing the Registry, which is dangerous no matter which tool you use.
Also, make sure to double-check your commands before executing, as you can make mistakes. For example, REG ADD HKLM\Sofware\MySubkey is not the same as REG ADD HKLM\Software\MySubkey. A mistake like that might not do anything, or it could wreck your entire system. So be careful.
If you’re wondering, yes, there is a big difference between Export and Save. The command EXPORT exports registry content into a text format that you can easily distribute as a .reg file to other computers.
On the other hand, SAVE saves the registry content into a hive file format (.hiv), which preserves ownership and other important information. You should only use this command if you’re restoring entries to the same computer.
It’s also important to note that while you can use many of these commands on a remote computer, IMPORT and EXPORT only work on a local computer (not over the network).
Although, we’re focusing this guide for Windows 10, keep in mind that reg.exe has been part of the operating system for a long time, as such this should also work on Windows 8.1 and Windows 7.
Do you prefer using the Registry Editor or reg.exe to modify the Windows Registry? Tell us in the comments below.
More Windows 10 resources
For more help articles, coverage, and answers on Windows 10, you can visit the following resources:
You can learn about more at Microsoft TechNet
We may earn a commission for purchases using our links. Learn more.
Halo: MCC’s live service elements make it better, not worse
Halo: The Master Chief Collection is more popular than ever, but some fans don’t agree with the live service approach 343 Industries has taken with it. Here’s why those elements are, at the end of the day, great for the game and for Halo overall.
Microsoft’s Surface Duo is not ‘failing up’
Microsoft announced this week that it was expanding Surface Duo availability to nine new commercial markets. While Surface Duo is undoubtedly a work in progress, this is not a sign of a disaster. It’s also doesn’t mean that Surface Duo is selling a ton either. Instead, the reason for the expansion is a lot more straightforward.
Here’s what you can do if Windows 10 update KB5001330 is causing issues
In this guide, we’ll show you the steps to get rid of the update KB5001330 to fix profile, gaming, and BSoD problems with the Windows 10 October 2020 Update and May 2020 Update.
These are the best PC sticks when you’re on the move
Instant computer — just add a screen. That’s the general idea behind the ultra-portable PC, but it can be hard to know which one you want. Relax, we have you covered!