• March 4, 2021 •

How to Create and Deploy .REG files (Registration Entries) in Windows?

Many of the tweaks in Windows involve adding entries to the Windows Registry using the Registry Editor. And if you have noticed, I also provide the contents of .reg file for a particular tweak, so that the user can make a .reg file and create an entry on the Registry Editor.

This article explains how to create and deploy .reg files.

How to Create a .REG file on Windows

For example. the code given below is the registry keys to bring back the ‘Open command Window here’ context menu on Windows 10. Let us say, you want to create a .reg file for the below code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTDirectoryshellcmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOTDirectoryshellcmdpromptcommand]
@="cmd.exe /s /k pushd "%V""

[HKEY_CLASSES_ROOTDirectoryBackgroundshellcmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOTDirectoryBackgroundshellcmdpromptcommand]
@="cmd.exe /s /k pushd "%V""

[HKEY_CLASSES_ROOTDriveshellcmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOTDriveshellcmdpromptcommand]
@="cmd.exe /s /k pushd "%V""

In order to create a .reg file, simply copy the above code contents and paste it in a new notepad text file.

How To Create And Deploy .reg Files (registration Entries) In Windows?

You should be very careful while pasting the content on to a new text file. Always make sure that there are no empty/blank lines at the top of the code. The first line of the .REG file always needs to the Windows Registry Editor Version 5.00 . If you get this wrong, you will face the Cannot import file: The specified file is not a registry script error.

Once you have pasted the content, press CTRL + S to save the file. There are a few things to note while saving the file:

  1. Always use the extension “.reg” at the end of the file.
  2. While saving, always give the file name between double-quotes. For example, cmdmenu.reg. This is to make sure that the file does not end up having a double extension. For example cmdmenu.reg.txt – this will not work.
How To Create And Deploy .reg Files (registration Entries) In Windows?

How add entry to Registry Editor using .REG file

Now that we have created the .REG file with the contents of the registry key, we are ready to add it to the Windows Registry using the Registry Editor.

To do this, go to the location where you have saved the file > Right-click on the .reg file > Select Merge.

How To Create And Deploy .reg Files (registration Entries) In Windows?

You will be prompted to make sure if you want to continue. Press Yes.

How To Create And Deploy .reg Files (registration Entries) In Windows?

Done. The key has not successfully been added to the Registry.

How to Create a .REG file by Exporting from Registry Editor

You can also create a registry file by exporting the keys from inside the Registry Editor.

Step 1. To do this, open Registry Editor: Press Windows Key + R > Enter regedit > Run.

Step 2. On you are in the Registry Editor, navigate to the key you want to export as a .REG file.

Step 3. Next, click on File > Export.

How To Create And Deploy .reg Files (registration Entries) In Windows?

Step 4. Save the file by giving a proper name with .reg extension.

Leave a Comment