What to Know
- To register file.dll, enter regsvr32 file.dll, and to unregister it, type regsvr32 /u file.dll into the command line.
- If you get an error, you may not have the correct permissions or the file may be blocked.
- Other errors may be from a missing dependency; use Dependency Walker to see dependencies the file requires.
This article explains how to use the regsvr32 command-line tool in Windows and how to fix some regsvr32 errors. Regsvr32 is used to register and unregister Object Linking and Embedding (OLE) controls, like DLL files and ActiveX Control .OCX files. You may need to register a DLL file if you see a DLL error on your computer.
How to Register and Unregister a DLL File
If the references in the Windows Registry that refer to the DLL file are somehow removed or corrupted, programs that need to use that DLL file may stop working. It's when this association with the registry is broken that a DLL file should be registered.
Registering a DLL file is typically accomplished by reinstalling the program that registered it in the first place. Sometimes, however, you may have to register the DLL file yourself manually via the Command Prompt.
This is the correct way to structure a regsvr32 command:
regsvr32 [/u] [/n] [/i[:cmdline]]
For example, you'd enter this first command to register a DLL file named file.dll, or the second to unregister it:
regsvr32 file.dll regsvr32 /u file.dll
Not all DLLs can be registered by just entering the command above. You might need to first close down the service or program that's using the file.
How to Fix Common Regsvr32 Errors
Here's one error you might see when trying to register a DLL file:
- The module was loaded but the call to DllRegisterServer failed with error code 0x80070005.
This is typically a permission issue. If running an elevated Command Prompt still doesn’t let you register the DLL file, the file itself might be blocked. Check the Security section of the General tab in the file’s Properties window.
Another possible issue could be that you don't have the correct permissions to use the file.
A similar error message is worded like the one below. This error typically means that the DLL isn't being used as a COM DLL for any application on the computer, which means there's no need to register it.
- The module was loaded but the entry-point DllRegisterServer was not found.
Here's another regsvr32 error message:
- The module failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files. The specified module could not be found.
That particular error might be due to a missing dependency, in which case you can use Dependency Walker to see a list of all the dependencies that the DLL file requires, as one may be missing that you need to have in order for the DLL to register correctly.
Also, make sure that the path to the DLL file is spelled right. The syntax of the command is very important; an error may be thrown if it’s not entered correctly.
Some DLL files may need to have their location surrounded in quotes like this:
Where Is Regsvr32.exe Stored?
32-bit versions of Windows (XP and newer) add the Microsoft Register Server tool to this folder when Windows is first installed: %systemroot%System32.
64-bit versions of Windows store the regsvr32.exe file not only there, but also here: %systemroot%SysWoW64.