setlocal ENABLEEXTENSIONS / ENABLEDELAYEDEX
Another title might be: "dereferencing with CMD"
setlocal ENABLEEXTENSIONS / ENABLEDELAYEDEXPANSION prevents an environment variable that's set in a called script from returning to the caller.
Ie/
Script1.cmd
@echo off
set RET=%1
set %RET%="My return value"
Executed from the command prompt:
Script1.cmd MyVariable
set MyVariablereturns
"My return value"
Adding:
setlocal ENABLEEXTENSIONS
setlocal ENABLEDELAYEDEXPANSIONcauses this behavior to fail.


