I read an interesting Experts Exchange topic. Search for the Goto Issue section. The example given by Qlemo goes something like this:
Code: Select all
set fruit=apples
if 1==1 (
echo(%fruit%
set fruit=bananas
goto nextline
:nextline
echo(%fruit%
)
Pretty cool, huh?


This leaves the door open to commit such attrocities as:
Code: Select all
setlocal enabledelayedexpansion
set "string=!%~1!" & set "substr=!%~2!"
for %%v in (string substr) do (
set "var=!%%v!"
for %%a in ("!LF!") do set "var=!var:%%~a=%%~L!"
for %%a in ("!CR!") do set "var=!var:%%~a=%%~3!"
if not defined notdelayed set "var=!var:^=^^^^!"
goto nextline
:nextline
if not defined notdelayed set "var=%var:!=^^^!%" !
set "%%v=!var!"
)
endlocal
The above isn’t a standalone working example, but you get the idea.

Hope you find this useful.
- SB