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
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_ROOT\Directory\shell\cmdprompt] @="@shell32.dll,-8506" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\cmdprompt\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt] @="@shell32.dll,-8506" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Drive\shell\cmdprompt] @="@shell32.dll,-8506" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Drive\shell\cmdprompt\command] @="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.
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:
- Always use the extension “.reg” at the end of the file.
- 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 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.
You will be prompted to make sure if you want to continue. Press Yes.
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.
Step 4. Save the file by giving a proper name with .reg extension.