echo off setlocal enabledelayedexpansion set "file=Config\__Config\server_config_common.xml" set "file_personal=Config\__Config\server_config_common_personal.xml" ( for /f "tokens=*" %%i in (%file%) do ( set s=%%i set s=!s:192.168.1.58=127.0.0.1! echo !s! ) )>%file_personal%
上面的脚本是把%file%中的192.168.1.58替换为127.0.0.1并把替换后的内容放到%file_personal%文件中