echo %var%

This code will echo the value of var

If setLocal EnableDelayedExpansion is used, the following will echo the value of var (the standard expression %var% will not work in that context).

echo !var!

In batch files, variables can be used in any context, including as parts of commands or parts of other variables. You may not call a variable prior to defining it.

Using variables as commands:

set var=echo
%var% This will be echoed

Using variables in other variables:

set var=part1
set %var%part2=Hello
echo %part1part2%