Batch Files - How to set command output as a variable

FOR /F "tokens=* USEBACKQ" %%F IN (`command`) DO (
SET var=%%F
ECHO %var%

I always use the USEBACKQ so that if you have a string to insert or a long file name, you can use your double quotes without screwing up the command.
Now if your output will contain multiple lines, you can do this
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`command`) DO (
  SET var!count!=%%F
  SET /a count=!count!+1
ECHO %var1%
ECHO %var2%
ECHO %var3%