Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Register dll and ocx file using batch file

I have dll and ocx file on folder on c dirve and want to register just by clicking on batch file

like image 750
Bimal K.C. Avatar asked Dec 16 '22 15:12

Bimal K.C.


2 Answers

According to this Microsoft knowledge base article:

Regsvr32.exe usage

RegSvr32.exe has the following command-line options:
Regsvr32 [/u] [/n] [/i[:cmdline]] dllname

/u - Unregister server
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)

When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsvr32.exe displays a dialog box that indicates success. If the attempt is unsuccessful, Regsvr32.exe returns an error message. This may include a Win32 error code.


Thus, the resulting batch file will be:

echo off 
Regsvr32 /s C:\MyDLL.dll
exit
like image 83
kunal Avatar answered Jan 02 '23 13:01

kunal


Try this batch code:

for %%f in (*.ocx *.dll) do regsvr32 %%f

Open Notepad and paste in the code, then save the file as register.bat and run it as an Administrator.

like image 22
zersina Avatar answered Jan 02 '23 14:01

zersina