联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off >test.txt echo 0344499084一 >>test.txt echo 0344499084二 >>test.txt echo 0344499084三 for /f "tokens=1,2* delims=:" %%i in ('type "test.txt"^|findstr /b /n "034"') do ( if "%%i"=="2" set "str=%%j" ) set "str=%str:034=34%" echo %str% pause
@echo off & Setlocal EnableDelayedExpansion for /f "tokens=1* delims=:" %%i in ('findstr /n .* test.txt') do ( set string=%%j if "%%i"=="2" (set string=!string:034=34!) >>new-file.txt echo\!string! ) start notepad new-file.txt