Reference for the FOR loop in CMD batch files, which repeats a command for each item in a list, file, folder set, number range or command output. It notes loop variables need a single letter, that variables only expand at loop start unless delayed expansion is used, and gives a short example creating 26 folders.
Explains how batch files check whether a command succeeded using %ERRORLEVEL% and IF ERRORLEVEL, including the gotcha that IF ERRORLEVEL n means n or greater. It covers why %ERRORLEVEL% does not update inside bracketed blocks, differences between .BAT and .CMD, and EXIT /B for returning codes.
The full command reference for robocopy, with every copy, retry, logging and job option plus a table of exit codes. Useful for backup scripts: it shows /MIR, /MT, /R and /W, /LOG, and how exit code 8 and above signals a real failure while lower values only describe what was copied. /MIR and /PURGE delete destination files missing from the source, so test with /L first.