这样的话看出来区别了吧。
再看一个=================================
@echo off
for /R "D:test" %%s in (*) do (
echo %%s
)
pause
结果
D:testA Folder 1A file 1.txt
D:testA Folder 1A file 2.txt
D:testA Folder 1A file 3.txt
D:testB Folder 2B file 1.txt
D:testB Folder 2B file 2.txt
D:testB Folder 2B file 3.txt
D:testB Folder 2B Folder 3B sub file 1.txt
D:testB Folder 2B Folder 3B sub file 2.txt
D:testB Folder 2B Folder 3B sub file 3.txt
就是只显示了文件
VisitF.bat - 对指定路径指定文件进行遍历的程序
:: VisitF.bat - 对指定路径指定文件进行遍历的程序
:: 第一参数为要遍历的文件(支持通配符),第二参数为要遍历的路径(缺省为C盘根)
@echo off
:main
if [%1]==[] if not exist goto end
:init
if exist if exist goto loop
set file=%1
set base=%2
if [%2]==[] set base=c:
dir %base%%file% /s /a /b >
echo e 100 ''set file='' >
echo w >>
echo q >>
:loop
fc nul /n | find " 1:" > setfile.bat
if errorlevel 1 goto restore
debug setfile.bat nul
call setfile.bat
echo Visiting the file: %file%
:: User specified visit code replace this line
find "%file%" /v
copy > nul
goto loop
:restore
if exist del
if exist del
if exist del
if exist setfile.bat del setfile.bat
:end
VisitD.bat - 对指定路径指定目录进行遍历的程序
:: VisitD.bat - 对指定路径指定目录进行遍历的程序
:: 第一参数为要遍历的目录(支持通配符),第二参数为要遍历的路径(缺省为C盘根)
@echo off
:main
if [%1]==[] if not exist goto end
:init
if exist if exist goto loop
set dir=%1
set base=%2
if [%2]==[] set base=c:
dir %base%%dir% /s /ad /b >
echo e 100 'set dir=' >
echo w >>
echo q >>
:loop
fc nul /n | find " 1:" > setdir.bat
if errorlevel 1 goto restore
debug setdir.bat nul
call setdir.bat
echo Visiting the dir: %dir%
:: User specified visit code replace this line
find "%dir%" /v
copy > nul
goto loop
:restore
if exist del
if exist del
if exist del
if exist setdir.bat del setdir.bat
:end
VisitL.bat - 对指定文件列表中的文件进行遍历的程序
:: VisitL.bat - 对指定文件列表中的文件进行遍历的程序
:: 参数为要遍历的文件列表
@echo off
:main
if [%1]==[] if not exist goto end
:init
set filelist=%1
if [%1]==[] set filelist=
if not exist %filelist% goto end
copy %filelist% > nul
if exist goto loop
echo e 100 'set file=' >
echo w >>
echo q >>
:loop
fc nul /n | find " 1:" > setfile.bat
if errorlevel 1 goto restore
debug setfile.bat nul









