有两个ini文件 位于C:\1.bat和C:\2.bat 两个ini文件第15行是一样的参数
Location MAC=XXXXXX
需要用bat将两个文件修改为指定参数Location MAC=00:00:00:00:00:00
求各路大神帮忙!
路径要是绝对路径才行的 ,真实的ini文件在四层目录里面。所以要绝对路径
XXXX不是定量,是随机的
亲,XXXX不是定量,是随机的,这行数值是的是第十五行
追答@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%1 in ('type "c:\1.ini"')do (set tmpstr=%%1&set tmp1=!tmpstr:~0,8!&(IF !tmp1!==Location (echo
Location MAC=00:00:00:00:00>>1tmp.txt))&(IF NOT !tmp1!==Location echo %%1>>1tmp.txt))
del c:\1.ini
move 1tmp.txt c:\1.ini
试试此例,此例假设 1.ini 文件中只有一行是以Location 开头的。
第二个文件同样处理。