- cd /d "%~dp0"
- for /f "delims=" %%i in ('dir/a-d/s/b "%~dp0*.txt"')do (
- (call:file "%%~fi")>"%%~fi_new%%~xi"
- )
- pause
- goto:eof
- :file
- for /f "delims=" %%i in ('type "%~f1"')do (
- set "_="&&set "#=%%i"&&set "n=0"&&call:data
- for /l %%n in (2,1,!o!)do if defined $%%n set "_=!_!!$%%n!"
- echo,!_:~0,-1!
- set "#=%%i"&&set "m=0"&&call:data_delete
- )
- goto:eof
- :data
- if not defined # goto:eof
- set/a "n+=1"
- for /f "tokens=1,* delims=," %%y in ("!#!")do set "$%n%=%%y,"&&set "#=%%z"
- rem:过滤行
- set "_=%$1%"
- set/a "o=%n%-2"
- set "$2=,"
- set "$3=,"
- set "$4=,"
- goto:data
- :data_delete
- if not defined # goto:eof
- set/a "m+=1"
- for /f "tokens=1,* delims=," %%y in ("!#!")do set "$%m%="&&set "#=%%z"
- goto:data_delete
复制代码
|