Board logo

标题: 求助:给txt中每行开头加上[行号] [打印本页]

作者: yywd     时间: 2008-4-15 09:08    标题: 求助:给txt中每行开头加上[行号]
求助:
给txt中每行开头加上[行号], [行号]从[000001]到[999999], []不能省掉

作者: ThinKing     时间: 2008-4-15 10:27
try this ?
@echo off & Setlocal EnableDelayedExpansion

for /f "tokens=1* delims=:" %%i in ('findstr/n .* a.txt') do (
set num=000000%%i
set num=!num:~-6!
echo.%%j
)
pause

作者: yywd     时间: 2008-4-15 12:28
简洁 高效, 谢 谢

作者: ZJHJ     时间: 2008-4-15 13:22
Originally posted by ThinKing at 2008-4-15 10:27:
try this ?
@echo off & Setlocal EnableDelayedExpansion

for /f "tokens=1* delims=:" %%i in ('findstr/n .* a.txt') do (
set num=000000%%i
set num=!num:~-6!
echo.




会掉字符哦