本帖最后由 canyuexiaolang 于 2012-9-1 17:04 编辑
- @echo off & setlocal enabledelayedexpansion & set /a reline=-1
- :-----------------------------------------------------------------------
- set "filename=test.txt"
- rem 设置文件名
- :-----------------------------------------------------------------------
- (for /f "tokens=1* delims=:" %%i in ('findstr /n .* "!filename!"') do (
- echo %%j | find "+" >nul && (set /a _linenum+=1,reline+=1
- set /a neline=!reline!!_linenum!,line=%%i,_temp=neline-line,_temp-=__temp,__temp=_temp
- for /l %%i in (1 1 !_temp!) do echo= & set /a endline+=1)
- echo=%%j & set /a endline+=1)
- set /a end=neline+9-endline
- if !end! lss 0 set /a end=~end
- for /l %%i in (1 1 !end!) do echo=
- )>_!filename!
- echo 完成^^!
- pause>nul
复制代码
最后测试通过 |