Register & Unregister a DLL from Windows Explorer


Back in my developer days when I was building DLLs and OCXs, I was constantly registering and unregistering DLLs using the command line (find me a dev who isn’t a command line junkie – I still have two prompts open as I type this). As time’s gone on, I submitted to using Windows Explorer more and more to do things and (this is going back many years), someone told me how to setup a shell extension to DLLs to allow you to register and unregister them directly. I guess I kept that file around all these years and it’s useful to find it again now I’m installing test builds regularly. Hopefully, it’s obvious how this works when you see the registry file below. Simply save as xyzzy.reg and merge it into the registry.

REGEDIT4
[HKEY_CLASSES_ROOT\.dll]
@=”dllfile”
[HKEY_CLASSES_ROOT\dllfile\shell]
@=”WIN_SYS”
[HKEY_CLASSES_ROOT\dllfile\shell\REG_32]
@=”Register”
[HKEY_CLASSES_ROOT\dllfile\shell\REG_32\command]
@=”regsvr32.exe %1″
[HKEY_CLASSES_ROOT\dllfile\shell\Unregister]
@=””
[HKEY_CLASSES_ROOT\dllfile\shell\Unregister\command]
@=”regsvr32.exe /u %1″
[HKEY_CLASSES_ROOT\.ocx]
@=”dllfile”

Once you click on a DLL in Windows Explorer, you’ll see two new options to Register and Unregister DLLs. Normal disclaimer applys about messing up your registry if you choose to use this etc.

Comments (7)

  1. David Douglass says:

    Something similar is to create a shortcut to regsvr32.exe and place it in your SendTo folder.  You can then register by pointing at a DLL/OCX and sending to regsvr32.exe.  You can also create an unregister shortcut simply by adding -u to the end of the target.

  2. jhoward says:

    David – should have thought of that. Already had for notepad….

    Cheers,

    John.

  3. Ed says:

    I needed to surround the %1 with double quotes ( "%1") or it wouldnt work for files that had a space in the path (e.g. Documents and Settings) – otherwise it’s great!

  4. Hehe says:

    Where is the registry for vista? Path and all