You can also use STRING as a "formatted string" by placing the desired variables in the right places, enclosed in exclamation points. Thus, further replacement of values ββis not required, just display the format string in the usual way:
rem Define the "format string" with Delayed Expansion disabled: set STRING=THIS IS !L! TEST setlocal enableextensions enabledelayedexpansion set /AL=2 :L1 if %L% EQU 0 goto :EOF echo %STRING% set /AL=L - 1 goto L1
Or without Delayed \ Expansion:
set STRING=THIS IS %%L%% TEST set /AL=2 :L1 if %L% EQU 0 goto :EOF call echo %STRING% set /AL=L - 1 goto L1
Antonio
source share