Let us say that you are trying to add a registry file (.reg) to the Windows Registry by double clicking the file (or by using the import option in the Registry Editor). But instead of the key getting add, you get the below error message:
Cannot import C:LocationToFileFile-Name.reg: The specified file is not a registry script. You can only import binary registry files from within the registry editor.
In this article, we shall see how to fix this issue.
Fix “The specified file is not a registry script” Error in Windows
Before moving to the actual fix, let us try to get a better idea as to why the error could have occurred. For that, he’s a brief explanation about the Registry Editor files.
Understanding the .REG Files
The .REG files, also called a Registration Entries, are used to add, modify, or delete values to the Windows Registry.
The Registry Editor (regedit.exe) uses the .reg files to manage registry subkeys and values. You can use these .reg files to deploy registry changes to several Windows-based computers. When you open a .reg file to add it to the Registry, the file contents merge into the local registry.
Here’s the syntax of a .REG file:
RegistryEditorVersion
Blank line
[RegistryPath1]
"DataItemName1"="DataType1:DataValue1"
"DataItemName2"="DataType2:DataValue2"
Blank line
[RegistryPath2]
"DataItemName3"="DataType3:DataValue3"
If you note here, the very first line of the .reg file is very important. The value for RegistryEditorVersion is either Windows Registry Editor Version 5.00
for Windows 2000 and higher, or REGEDIT4
for Windows 98 and Windows NT 4.0. Note that the REGEDIT4
is upward compatible – meaning that this header will also work fine on Windows 2000 or later too (including Windows 10).
The first line of a .reg file should always be the Registry Editor Version. It should always be followed by a blank line.
Fix the .REG file Syntax and Formatting
There are two reasons why you might have got the ‘The specified file is not a registry script.’ error message:
- The first on your .REG file is empty.
- The header (which is the first line) in the .REG file is incorrect.
You can fix this easily by following these steps:
Step 1. Open the .reg file using Notepad. To do this: Right-click on the .reg file and choose ‘Edit’.
Step 2. Remove the blank line at the top of the file.
Step 3. Make sure the Registry Editor Version does not have any spelling mistakes. It should either be Windows Registry Editor Version 5.00
for Windows 2000 and higher, or REGEDIT4
for older versions of Windows. Any other values than this are not valid.
Still getting the same error?
1. If you had used any other text editor other than Notepad, there is a good chance that there are extra formatting codes added to the file by that particular editor. In such case, re-edit the .reg file in Notepad or create a new .reg file with Notepad altogether.
2. Here’s the Microsoft’s official guide to Add, modify, or delete registry entries by using a .reg file to Windows. I recommend giving this a read.
This should help you fix the The specified file is not a registry script. You can only import binary registry files from within the registry editor” error while importing the .reg files to Registry Editor.
Thanks. This was very helpful.
Glad it helped! 🙂