使用批处理文件注册dll和ocx文件

Bim*_*.C. 4 windows windows-xp

我在c dirve上的文件夹上有dll和ocx文件,只想通过单击批处理文件进行注册

小智 6

根据这篇Microsoft知识库文章:

Regsvr32.exe用法

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)
Run Code Online (Sandbox Code Playgroud)

使用时Regsvr32.exe,它会尝试加载组件并调用其DLLSelfRegister功能.如果此尝试成功,则Regsvr32.exe显示一个表示成功的对话框.如果尝试失败,则Regsvr32.exe返回错误消息.这可能包括Win32错误代码.


因此,生成的批处理文件将是:

echo off 
Regsvr32 /s C:\MyDLL.dll
exit
Run Code Online (Sandbox Code Playgroud)


rer*_*run 1

只需放入regsvr32 pathto.exe批处理文件,假设该文件regsvr32位于路径上。