从test.txt里查找CLIENT_HOME 按=分割,获取值 替换1.txt里的所有CKIENT_HOME
由于修改的文件是xml,所以需要chcp 65001切换编码到utf8,否则会出现中文乱码
批处理bat:
adding: 0px; font-family: arial, 'courier new', courier, 宋体, monospace, 'Microsoft YaHei'; white-space: pre-wrap; word-wrap: break-word; word-break: break-all; color: rgb(51, 51, 51); line-height: 20px;">
@echo off
chcp 65001
for /f "tokens=1,2 delims==" %%a in ('Type conf.properties^|Findstr CLIENT_HOME') do (
set "c1=%%a"
set "new=%%b"
goto end
)
:end
echo %new%
ren cgame.as3proj a.txt
for /f "delims=" %%i in ('findstr "CLIENT_HOME" a.txt')do (
for /f "delims=" %%j in ('type "a.txt"') do (
if %%i==%%j (
setlocal Enabledelayedexpansion
set "var=%%i"
set "var=!var:CLIENT_HOME=%new%!"
echo !var!>>b.txt
endlocal
)else echo %%j>>b.txt
)
)
ren b.txt cgame.as3proj
del a.txt b.txt
pause