@echo off
setlocal enabledelayedexpansion set main_str=hello world set src=hello set dst=hi echo %main_str% set sub_str=!main_str:%src%=%dst%! echo %sub_str%
批处理命令:带参数的字符串替换
原文:http://blog.csdn.net/wjj715211/article/details/41015729