有時候用電腦的時候遇到由于DLL文件丟失或損壞而造成的種種故障,大家都只知道只要重新注冊一下DLL文件就可以了,但是對于新手來說即使知道是DLL文件損外,但是不知道是哪個DLL文件也束手無策,所以用這個批處理可以循環注冊DLL文件,達到解決由于DLL丟失的種種故障!
for %%i in (%windir%/system32/*.dll) 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