@echo off
set a=one
set b=two
echo/Before call :swap a b
call :Swap a b
echo/After call 1 :swap a b
call :Swap b a
echo/After call 2 :swap b a
pause
goto :EOF
:Swap
call set a=%%%1%%
call set b=%%%2%%
set "%1=%b%" & set "%2=%a%" & goto :EOF
----------------------------------------------------------------------
Displayed result:
Before call :swap a b
After call 1 :swap a b
After call 2 :swap b a
I really can't figure it out, please explain..
set a=one
set b=two
echo/Before call :swap a b
call :Swap a b
echo/After call 1 :swap a b
call :Swap b a
echo/After call 2 :swap b a
pause
goto :EOF
:Swap
call set a=%%%1%%
call set b=%%%2%%
set "%1=%b%" & set "%2=%a%" & goto :EOF
----------------------------------------------------------------------
Displayed result:
Before call :swap a b
After call 1 :swap a b
After call 2 :swap b a
I really can't figure it out, please explain..


