wufeishi 当前离线
一级士官
weichenxiehou 当前离线
上尉
@echo off (for /f "tokens=2 delims=:" %%i in ('findstr /n .* test.ini') do ( set "str=%%i" set/a n+=1 setlocal enabledelayedexpansion if !n! equ 29 (set flag=1&if "!str!"=="programno=01" (echo programno=02)else echo programno=01)else set flag= if not defined flag echo !str! endlocal ))>new.ini move /y new.ini test.ini复制代码
TOP
CrLf 当前离线
论坛巡查
@echo off&setlocal enabledelayedexpansion >nul 3>2.txt for /f "tokens=1* delims==" %%a in (1.ini) do if "%%a"=="programno" ( set /a n=^!(1%%b-101)+101 echo %%a=!n:~1! ) else echo %%a=%%b move 2.txt 1.ini复制代码
wc726842270 (枫中残雪)当前离线
大校
@echo off for /f "tokens=1-3 delims==:" %%i in ('findstr /nic:"programno=" a.ini') do echo 当前a.ini中progamno的值%%k,行数为%%i set /p b=请指定操作行:(参考上面) set /p a=请输入操作值:(1或2) (for /f "delims=" %%i in ('sed %b%s/0[12]/0%a%/ a.ini') do echo %%i)>2.ini if exist 2.ini (del a.ini&& ren 2.ini a.ini)复制代码