N
N
nen0y2017-10-30 13:20:17
cmd/bat
nen0y, 2017-10-30 13:20:17

How to create a batch file that will remove files from a list?

How to create a batch file that will remove files from a list?
There is a file that contains the names of text documents (1.txt 2.txt 3.txt).
When I run a batch file, it should read the names of text documents from this list and delete the files. How to do it?
All files are located in the D:\lab folder

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Olgeir, 2017-10-30
@Olgeir

set files_list=c:\a.list
dir /b /sc:\*.bat >>%files_list%
for /f %%A in ("%files_list%") do del /q %%A

R
res2001, 2017-10-30
@res2001

just list all the files in the del command like this:
del /f /q file1.txt file2.txt pathdir\file*.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question