@echo off
set /p input=请输入要删除的文件名(分号隔开;):
set input=%input:k=1%
set "folder=test"
for /f "tokens=1-4 delims=;" %%1 in ("%input%")do set /a d1=%%1,d2=%%2,f1=%%3,f2=%%4
(for /l %%1 in (%d1% 1 %d2%)do (
set d=k%%1
call set d=%%d:k1=k%%
for /l %%2 in (%f1% 1 %f2%)do (
call set #del_%%d%%\%%2=%~dp0%folder%\%%d%%\%%2 & call echo 要删除的文件 -- %~dp0%folder%\%%d%%\%%2
)
))>过目.txt
start "" "过目.txt"
set /p input=确认要删除吗?:[Y/回复其他退出]
if /i %input%==y (
for /f "tokens=2 delims==" %%1 in ('set #del_')do (
if exist "%%1" (
rd /s /q %%1
md %%1
)else (
echo 文件夹不存在 -- %%1
)
)
)else (
exit
)