菜鸟回复----》
如下不知道,是不是你想要的。- @echo off
- echo ---------------------------------
- echo output row 3 to a new txt.
- echo ---------------------------------
- :: Step1, Catch all txt file and save to namelist.txt
- if exist namelist.txt del namelist.txt
- if exist namelist.lst del namelist.lst
- for %%i in (*.txt) do echo %%i>>namelist.lst
- cd.>namelist.txt
- for /f "tokens=1,2 delims=." %%J in (namelist.lst) do echo %%J >>namelist.txt
- del namelist.lst
-
- :: Step2, output row 3 to a new txt.
- cd.>aa.txt
- setlocal enabledelayedexpansion
- for /f %%C in (namelist.txt) do (
- set n=0
- for /f "delims=" %%b in (%%C.txt) do (
- set /a n=n+1
- if "!n!"=="3" echo %%C %%b>>aa.txt
- )
- )
-
- del namelist.txt
- pause
复制代码
|