问题
I've hit rock bottom, I can't seem to get this work!
setlocal EnableDelayedExpansion
for %%g in (1,2,3) do (
set /a c=%%g+32
echo %c%
)
pause
But it says ECHO is on, I know this means that it has nothing to display, but how couldn't it have something to display? I tried changing many things (adding/removing setlocal for example) but it won't work.
Any help is GREATLY appreciated!
回答1:
for %%g in (1,2,3) do (
set /a c=%%g+32
echo !c!
)
In set /? written that we should use ! for this situation.
来源:https://stackoverflow.com/questions/11571926/batch-file-fails-to-echo-variable-inside-loop