When making changes to the Windows Registry, you can open the Registry Editor and edit the keys and values you need to adjust. But what if you need to make a lot of changes all at once? When this happens, entering them one by one can get tedious pretty quickly.
With a registry file, however, you can apply several changes to the Windows Registry at once. You just need to know how to create a registry file and what lines to put in it.
So what is a Windows registry file, and how do you create and use it? Here’s what you need to know to get started with these powerful files.
What Is a Windows Registry File?
A registry file is a file used to update the Windows Registry, either by adding, editing, or removing keys and values. It’s a text file with a .reg file extension, which is why you’ll also hear people call them REG files.
How to Create a REG File Using Notepad
If you want to create a REG file from scratch, you can use a text editor like Notepad. This requires knowing the basic structure of a registry file.
If you’re not sure what a registry file looks like, don’t fret; we’ll help you through the process. So, boot up Notepad, and let’s get started.
For the sake of this guide, we’re going to create a registry file that will perform the steps we covered in our guide on how to add a “Boot to Advanced Startup Options” to the context menu.
The first line of a REG file is the version of the Registry Editor you’re using. Here’s the version we entered in Notepad.
Windows Registry Editor Version 5.00
Next, we’re going to add the file path to the key we want to change, but it should be enclosed within square brackets. If the key isn’t available, the Registry Editor will create it. To do that, enter the below text in Notepad:
Next, let’s create an entry and change its value. You must specify the entry’s data type before assigning it the value. Here’s the structure of the line you need to enter:
We are going to create a string value, and here’s what the actual line would look like in Notepad:
“MUIVerb”=“Boot to Advanced Startup Options”
If we’re going to add another value to the key, we have to add it directly below the last line. Like this:
If you’re going to add another key and associated values, you’d need to specify that key’s path as well, and then enter the values. To finish the REG file we’re creating, we’ll add a new key and value:
@=“shutdown.exe /r /o /f /t 00”
Don’t be confused by the @ sign in the last line, as it denotes we’re editing the (Default) string value in the command key.
So, the final REG file in Notepad should look like the screenshot below.
You can add as many keys and values as you want to the REG file.
Now, press Ctrl + S or click File > Save. Then, give the file a name, make sure it has a .reg extension, and click Save.
Now you’re ready to run that registry file so the keys and values merge with the Registry.
How to Use the Registry File You Created
Editing the Registry is an advanced way to make changes to your Windows PC. So before you do anything to it, we recommend creating a System Restore point. If you break the Registry, there’s a chance you can break Windows as well, and that’s why it’s always a good idea to have some sort of backup you can use to restore your system.
To open the REG file you created, navigate to its location, double-click it, and click Yes on the UAC prompt. You’ll then get a warning asking if you’re sure you want to continue. Since we know what we’re doing, we’re just going to go ahead and click Yes.
You’ll then get a message that the Registry editor has successfully added the keys and values contained in the REG file to the Registry. Click OK to close the message.
You can also import the REG file by opening the Registry Editor and clicking File > Import in the top left corner.
In the dialog box, select the registry file you created and click Open to perform the merge. You’ll get a message telling you that the keys and values have been merged successfully. Click OK to close it.
When you open the Registry Editor and navigate to the keys specified in the REG file, you’ll see that the keys and the values are all there.
If you want to see another example where we modify the Windows Registry with a REG file, please read our guide on adding the “Create System Restore Point” option to the context menu.
How to Export and Edit a REG File on Windows
You don’t always have to create a REG file from scratch. You can also export an existing key using the Registry Editor, and update the resulting registry file’s keys and values in Notepad.
To do that, Press Win + R to open the Windows Run dialog box, type regedit, and click OK. Click Yes on the prompt from the UAC, and in the Registry Editor, right-click a key and select Export.
In the Save dialog box, give the REG file a name, choose a location to save it in, and click Save. Once the Registry Editor creates the REG file, you can edit it using a text editor like Notepad or a code editor like VSCode.
How to Delete a Key in the Windows Registry Using a REG File
An easy way to delete a key in the Registry is to do it directly in the Registry Editor. But if there are many of them, you can simply use a registry file. Continuing with the example above, here’s what the registry file would look like:
Windows Registry Editor Version 5.00
Here, we’ve just deleted the entire AdvancedStartup key by putting a minus sign at the start of the file path.
Now You Know How to Create Registry Files on Windows
You can make the process of tweaking the Windows Registry easier by using REG files. Once you know how to create or edit them, you can take your Windows customization skills to the next level. Gone will be the days of tiresomely adding keys and values to the Registry one by one using the Registry Editor.
Of course, this guide only scratches the surface of what you can do with REG files, so consider it as a starting point.