
CODE: [Copy to clipboard]缺陷0344499034二会有问题@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
CODE: [Copy to clipboard]@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
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |