I have a question with regards to variable substring substitution in an NT batch program. For example, the following piece of code works as expected and replaces 'ab' with 'xy'.
::Edit and replace the character string 'ab' with 'xy'
SET v_test=123abcd
Set v_replacement=xy
SET v_result=%v_test:ab=xy%
ECHO %v_result% = 123xycdHow can I perform the substitution, when the replacement string is a variable instead of the contant string 'xy'
i.e. I want to replace 'ab' with the contents of the variable %v_replacement%, instead of the hardcoded value 'xy' ?Thanks.

The command prompt as to be executed with
ENABLEDELAYEDEXPANSION for the code below
to work.
1, Right click the "Command Prompt" as add
the "/v" in the Target box as below.
and run the code.
%SystemRoot%\system32\cmd.exe /vTested with WinXP Pro.
@echo off
SET v_test=123abcd
Set v_replacement=xy
SET v_result=%v_test:ab=!v_replacement!%
ECHO %v_result%=123xycd
