bat替换文件的指定内容
需求:替换文件my.ini中的1000 为10000,bat脚本如下:
c:
cd C:\Program Files\MySQL\MySQL Server 5.5
copy my.ini my1126bak.ini
@echo off
setlocal enabledelayedexpansion
set fn=my.ini
(for /f "tokens=*" %%i in (%fn%) do (
set s=%%i
set s=!s:1000=10000!
echo !s!))>temp1126.txt
move /y temp1126.txt "%fn%"