I've got the code below, try to re-set variable "name" inside an if-else block:
@echo off
set name=kk
echo %name%
if "%name%"=="jj" (
echo case1
) else (
echo case2
set name=ll
echo name=%name%
)
Under cmd of win10, it outputs:
aa
kk
case2
name=kk
This is weird, I wish that my last echo should print:
name=ll
Seems the "set name=ll" didn't work. So would you help to explain why it didn't work as I expected, and how to fix it?
Thanks a lot.
Aucun commentaire:
Enregistrer un commentaire