If you need to reg­is­ter .dll and .ocx files in a direc­tory (and below), this lit­tle batch file should help you:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@echo off
::you need to start this .cmd file with a
::para­me­ter, to pre­vent an unin­tended start.
if %1$ == $ goto:eof

set­lo­cal
::com­ment this line out when you want to call regall.cmd from
::a dif­fer­ent direc­tory and reg­is­ter all the files in the CURRENT
::direc­tory. If you leave this line uncom­mented regall.cmd will
::reg­is­ter all files in the direc­tory where regall.cmd is stored!
cd /d %0..

for /f “tokens=*” %%i in (‘dir *.dll;*.ocx /b /s’) do call :REGIT “%%i“
goto :eof

:REGIT
echo reg­is­ter %1
regsvr32 /s %1
goto:eof

If you need to unin­stall those files, you only need to change “regsvr32 /s %1″ to “regsvr32 /u /s %1″

Or if you like it sim­ple and small:

1
2
3
for %i in (*.dll;*.ocx) do regsvr32 /s %i (all *.dll and *.ocx files in the cur­rent direc­tory)
for /D %i in (*) do echo %i (show all direc­tory names in the cur­rent direc­tory)
for /R %i in (*.dll;*.ocx) do regsvr32 /s %i (all *.dll and *.ocx files in the cur­rent direc­tory and below this direc­tory, r=recur­sive)