用bat修改ini配置文件指定内容
输入不保存
@echo off&cd /d "%~dp0"
rem 修改一个ini文件里的指定行内容
title
set "inifile=a.ini"
if not exist "%inifile%" (echo;"%inifile%" path error or not exists&pause&exit)
set user=&set /p user=enter the user:
set linenum=&for /f "delims=:" %%a in ('type "%inifile%"^|findstr /nb /c:"user="') do set "linenum=%%a"
if defined linenum (
for /f "tokens=1* delims=:" %%a in ('type "%inifile%"^|findstr /n .*') do (
if "%%a" equ "%linenum%" (
echo;user=%user%
) else echo;%%b
)
)