Question

I wonder why this code does not work as expected:

@ECHO off
SET S1=HELLO

SETLOCAL EnableDelayedExpansion
SET S2=!S1! WORLD^^!
ECHO !S2!
ENDLOCAL & SET S1=!S2!

ECHO %S1%
PAUSE

Output:

HELLO WORLD!
!S2!

Expected output:

HELLO WORLD!
HELLO WORLD!

Thanks.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top