Question: I need to remove certain dlls from Test folder and it’s subfolder as well. For example I need to delete 1.dll, 2.dll, 3.dll wherever these are present in the Test folder using batch script. In batch script code I provided the option for user to provide the input of the path, so that it can be used by anyone based on folder path. Below is my Batch script code.
Code: Select all
@echo off
cls
set /p path=Enter destination folder :
set list=ActiveReports.Chart.dll ActiveReports.Document.dll ActiveReports.HtmlExport.dll
set back=%cd%
Rem echo %list%[0]
set count = 0
set notfounddlls=""
REM for %%a in (%list%) do echo(del /s/q %var%\%%a)
for /d /r %%d in (%path%\*) do (
rem set test = %%d
echo --------------------------
rem echo %%d
rem echo --------------------------
pushd %%d
cls
rem for %%i in %list% do (echo %%i)
(for %%a in (%list%) do (
rem echo %%a
IF exist %%a (
set count =1.
del %%a.
Echo %%a deleted
) ELSE (
set count = 0.
ECHO %%a file not found in %%d.
rem set notfounddlls=%notfounddlls%;%%a
rem ECHO Nothing has been deleted from %%d.
rem ECHO.
)
))
cd
cd %back%
)
pause