try
setlocal /?
on command prompt
As for if statements: help if should show you everything you need to know. Batch files have only single line if statements of the forms
if [condition] [statement]
if [condition] [statement] else [statement]
However, [statement] can be a block, delimited by parentheses:
if [condition] (
[statement]
[statement]
...
)
if [condition] (
[statement]
...
) else (
[statement]
...
)
There is no explicit end if keyword. The end of the if statement is marked by the end of the line or by the end of the parenthesized block.
Also keep in mind that you need to be careful with setting and subsequently using environment variables in a single block. Read up in help set on delayed expansion for the pitfalls there.