但是对于新手来说即使知道是DLL文件损外,但是不知道是哪个DLL文件也束手无策,所以用这个批处理可以循环注册DLL文件,达到解决由于DLL丢失的种种故障!

下面这个是注册system32目录下的所有dll
实现代码如下:
for %%i in (%windir%\system32\*.dll) do regsvr32.exe /s %%i


如果想自定义目录可以改成这样的
实现代码如下:
For %%i in (你要注册的DLL文件目录\*.dll) Do regsvr32.exe /s %%i For %%i in (你要注册的DLL文
件目录\*.ocx) Do regsvr32.exe /s %%i


下面是单个注册dll文件的方法(这里以w32time.dll为例)
实现代码如下:

@echo 开始注册
copy w32time.dll %windir%\system32\
regsvr32 %windir%\system32\w32time.dll /s
@echo 注册成功
@pause

使用的时候替换掉w32time.dll即可

下面是单个或多个批处理注册的代码,大家可以修改下

1)注册

Regist.bat
实现代码如下:

@echo 开始注册
net stop iisadmin /y
@echo 跳转到当前批处理文件路径
cd %~dp0
copy DynamicGif.dll %windir%\system32
regsvr32 %windir%\system32\DynamicGif.dll /s

copy ImageOle.dll %windir%\system32
regsvr32 %windir%\system32\ImageOle.dll /s
net start w3svc
@echo 注册成功
@pause


2)重新注册

ReRegist.bat
实现代码如下:

@echo 重新注册
net stop iisadmin /y
@echo 跳转到当前批处理文件路径
cd %~dp0
regsvr32/u %windir%\system32\DynamicGif.dll /s
del %windir%\system32\DynamicGif.dll
copy DynamicGif.dll %windir%\system32
regsvr32 %windir%\system32\DynamicGif.dll /s

regsvr32/u %windir%\system32\ImageOle.dll /s
del %windir%\system32\ImageOle.dll
copy ImageOle.dll %windir%\system32
regsvr32 %windir%\system32\ImageOle.dll /s
net start w3svc
@echo 重新注册成功
@pause


3)反注册

UnRegist.bat
实现代码如下:

@echo 删除注册
net stop iisadmin /y
@echo 跳转到当前批处理文件路径
cd %~dp0
regsvr32/u %windir%\system32\DynamicGif.dll /s
del %windir%\system32\DynamicGif.dll
regsvr32/u %windir%\system32\ImageOle.dll /s
del %windir%\system32\ImageOle.dll
net start w3svc
@echo 删除注册成功
@pause

以上就是【批处理文件(bat文件)注册dll批量注册dll】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)
发表我的评论

最新评论

  1. 暂无评论