我在c盘上的文件夹上有dll和ocx文件,只想通过点击批处理文件进行注册
答案 0 :(得分:6)
根据this Microsoft knowledge base article:
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)
使用
Regsvr32.exe
时,它会尝试加载组件并调用其DLLSelfRegister
函数。如果此尝试成功,Regsvr32.exe
将显示一个表示成功的对话框。如果尝试失败,Regsvr32.exe
将返回错误消息。这可能包括Win32错误代码。
因此,生成的批处理文件将是:
echo off
Regsvr32 /s C:\MyDLL.dll
exit
答案 1 :(得分:3)
试试这个批处理代码:
for %%f in (*.ocx *.dll) do regsvr32 %%f
打开记事本并粘贴代码,然后将文件另存为register.bat
并以管理员身份运行。
答案 2 :(得分:1)
只需将regsvr32 pathto.exe
放入批处理文件中,假设路径上有regsvr32
。
答案 3 :(得分:1)
您希望以静默方式运行此操作,因为多个错误可能会导致explorer.exe出现问题 for%x in(c:\ windows \ system32 * .dll)do regsvr32 / s%x