目標:在一臺計算機的每個DLL文件傳遞到regsvr32.exe的批處理/ CMD:打印一個.txt的每一行到一個變量
完成: CD \
:: REM導出每個文件和目錄(/ s)複製到c:根目錄下的一個文件中:dir.txt只包含文件名(/ b)
dir/s /b>>dir.txt
:: REM現在,這將包含每個擴展類型。我們只希望dll的,所以我們FINDSTR成dll.txt:
FINDSTR 「.DLL $」 DIR.TXT >> dll.txt
扭結:
現在,如果我想的regsvr32.exe 「文件」現在在dll.txt中的每個文件,我需要分離出每行上單獨的每個文件名。我想知道是否有第三方命令行工具可以將文件的每一行導出到變量中。這樣一來,我可以:
==========
:: REM承擔這個工具有開關/升的行號,和/ V:「」變量使用,和所使用的「文件」末:
set line=1
:loop
set dll=
tool.exe /l %line% /v:"dll" "dll.txt"
::REM We if defined here because if the line doesn't exist in dll.txt, the tool would return nothing to %dll%
if not defined %dll% exit
::REM With the variable defined, we can continue
regsvr32.exe %dll%
set /a line=%line%+1
goto loop
=======================
然後,刀具將處理每一路徑直到它自動退出,因爲沒有更多的行。注意在循環之後,我將dll設置爲空,因此'如果未定義'將每次都有效。
如果這種類型的第三方工具不能完成,有沒有辦法做到這一點? 我真的從來沒有學過,並試圖但永遠不知道。
任何幫助,非常感謝!
對不起,如果這已被回答。
編輯/更新: 我已經發現我將如何使這項工作。
感謝:http://pyrocam.com/re-register-all-dlls-to-fix-no-such-interface-supported-error-in-windows-7-after-installing-ie7-standalone/
和:Read a txt line by line in a batch file
第一個鏈接顯示了regsvr32.exe的
第二表示人工更換開始如何在這種情況下也{由於使用到craig65535他的幫助: )}
代碼:
@echo off
color 1f
title Register .dll
echo.
echo Exporting file list . . .
echo.
cd /d c:
cd\
if exist dll.txt del dll.txt
if exist dir.txt del dir.txt
if exist dll.bat del dll.bat
echo Part 1 of 3 . . .
echo.
dir /s /b>>dir.txt
echo Part 2 of 3 . . .
echo.
findstr ".dll$" dir.txt>>dll.txt
del dir.txt
echo Part 3 of 3 . . .
echo.
for /f "delims=" %%i IN ('type dll.txt') do echo regsvr32.exe /s "%%i">>dll.bat
del dll.txt
echo Ready to begin regsvr32.exe . . .
echo.
pause
echo.
echo Beginning registration . . .
echo *This will take time, close any popups that occur
echo.
call dll.bat
echo.
echo Deleting registration file . . .
if exist dll.bat del dll.bat
echo.
echo DONE.
echo.
pause >nul
正是我在想什麼。我只是有問題。你的類型想法可能是解決方案。感謝您的幫助論壇! –