Why does the following successfully echo %vol% whereas if I delete the goto done it will not echo %vol%?
@echo off
setlocal DisableDelayedExpansion
pushd d:
for /f "tokens=1-5*" %%1 in ('vol') do (
set vol=%%6 & goto done
)
:done
echo.%vol%
pause
EXIT /b
This is a question similar to, but not the same as DOS batch: SET variable and ECHO it within (...) block
Even without the goto done %vol% survives the end of the block since I can use it in comparisons, and even echo it using enabled expansion. I'm curious why just the echo command seems to be crippled with disabled expansion.