|
|
批处理问题,请教
[UploadFile=2_3199_3.rar]@echo off
rem 找当前目录(根目录)的*.txt
for %%a in (*.txt) do type %%a
rem 以下为找当前目录(根目录)的所有子目录下的所有*.txt
set i=1
set j=1
set filenum=0
set dirnum=0
varset root=FULL of . >temp.bat
call temp.bat
varset rootdir=string(3) %root% >temp.bat
call temp.bat
dir /ad /b /s >temp.txt
varset dirnum=lines temp.txt >temp.bat
call temp.bat
:loop1
type %root%\temp.txt | %root%\LMOD /L%i% set curdir=[] >%root%\temp.bat
call %root%\temp.bat
varset curdir=string(3) %curdir% >%root%\temp.bat
call %root%\temp.bat
cd %curdir%
echo %curdir%
set j=1
:loop2
%root%\varset filenum=files *.txt >%root%\temp.bat
call %root%\temp.bat
if %filenum%==0 goto end2
dir *.txt /b | %root%\LMOD /L%j% set curfile=[] >%root%\temp.bat
call %root%\temp.bat
type %curfile%
if %j%==%filenum% goto end2
%root%\varset j=%j%+1 >%root%\temp.bat
call %root%\temp.bat
goto loop2
:end2
cd %rootdir%
if %i%==%dirnum% goto end1
%root%\varset i=%i%+1 >%root%\temp.bat
call %root%\temp.bat
goto loop1
:end1
del %root%\temp.bat
del %root%\temp.txt
set i=
set j=
set filenum=
set dirnum=
set root=
set rootdir=
set curdir=
set curfile= |
|