(4) How to Register an ActiveX DLL from a DOS .bat Script

Run the .bat As Administrator to register to a Local Machine Registry.

Run the .bat normally (not As Administrator) to register to a Current User Registry.

  • The regsvr32 command does the registration.
  • Windows provides both 32-bit and 64-bit regsvr32 commands.
  • Use the 32-bit regsvr32 to register to a 32-bit registry.
  • Use the 64-bit regsvr32 to register to a 64-bit registry.

On a 64-bit Windows system, the 64-bit regsvr32 command is simply regsvr32. Here is a sample .bat script to register all DLLs located in the same directory as the .bat script:

@echo off
cd %~dp0
set "filemask=*.dll"
for %%A in (%filemask%) do regsvr32 %%A || GOTO:EOF
ECHO.&PAUSE&GOTO:EOF
	    

On a 64-bit Windows system, the 32-bit regsvr32 command is %systemroot%\syswow64\regsvr32. Here is a sample .bat script to register all DLLs located in the same directory as the .bat script:

@echo off
cd %~dp0
set "filemask=*.dll"
for %%A in (%filemask%) do %systemroot%\syswow64\regsvr32 %%A || GOTO:EOF
ECHO.&PAUSE&GOTO:EOF
	    

ActiveX Registration Tutorial - Page 3

ActiveX Registration Tutorial - Page 5