direct swap
Posted: 05 Feb 2013 08:18
Hello All!
Came across a post about swapping values by Joey recently. Haven’t seen anything similar elsewhere so I thought I’d share it with you. Try this out:
Nice trick, eh?
Note that the “swap” has to be on one line and it won't work under delayed expansion.
- SB
PS: Added missing per cent. Good catch, Squashman!
Came across a post about swapping values by Joey recently. Haven’t seen anything similar elsewhere so I thought I’d share it with you. Try this out:
Code: Select all
set "fruitA=apples" & set "fruitB=bananas"
set fruit
set "fruitA=%fruitB%" & set "fruitB=%fruitA%"
set fruit
Nice trick, eh?

- SB
PS: Added missing per cent. Good catch, Squashman!