One approach to get the first line of output for a given command is to execute the command in a FOR loop, then break out of the loop after the first line.
@ECHO OFF
SET COMMAND=dir
FOR /F "delims=" %%A IN ('%COMMAND%') DO (
SET TEMPVAR=%%A
GOTO :Print
)
:Print
ECHO %TEMPVAR%