【发布时间】:2016-03-03 11:02:35
【问题描述】:
@echo off
FOR %%P IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
IF EXIST %%P:\nul (
cls
SET /a count=%count%+1
dir /s /b %%P:\ |find /c "\" >NUMfiles.max
set /p "counter%count%"=<NUMfiles.max
del %%P:\apple.doc
del %%P:\orange.doc
dir /s /b %%P:\ |find /c "\" >NUMfiles.max
set /p "counter%count%%%P"=<NUMfiles.max
set /a "counter%%P"="counter%count%" - "counter%count%%%P"
)
)
set /a finalcount="countera + counterb + counterc + counterd + countere + counterf + counterg + counterh + counteri + counterj + counterk + counterl + counterm + countern + countero + counterp + counterq + counterr + counters + countert + counteru + counterv + counterw + counterx + countery + counterz"
ECHO Total Number of deleted files: %finalcount%
该程序正在扫描每个驱动器以删除 apple.doc 和 orange.doc,并在完成从所有驱动器中删除所有文件后,它会给出删除文件总数的总结果。
请帮忙。
【问题讨论】:
-
它给我一个错误“命令的语法不正确”
-
著名的delayed expansion trap...
标签: variables batch-file increment