本帖最后由 tmplinshi 于 2011-3-24 02:07 编辑
- @echo off
-
- set "OutDir=#1#"
- md "%OutDir%" 2>nul
-
- for /f "delims=" %%f in (' dir /b *.txt ') do (
- if %%~zf neq 0 (
- findstr /n "^$" "%%f" >.tmp
- set n=0
- set /p n=<.tmp
- set /a n = n, n_ = n
- call :o "%%f" >"%OutDir%\%%~nf_%%~xf" 2>nul
- )
- )
- exit /b
-
- :o
- for /f "eol= usebackq delims=" %%s in ("%~1") do (
- echo,%%s
- set /a "n -= 1, 1 / (n - 1)" || (
- more +%n_% %1 >.tmp
- move .tmp %1
- goto :eof
- )
- )
- move .tmp %1
复制代码
|