Use a for /F loop loop to capture the output of your wmic command line:
for /F "skip=1" %%E in ('
    wmic path Win32_PhysicalMemory get FormFactor
') do for /F %%F in ("%%E") do set "FF=%%F"
if %FF% equ 12 (
    echo FormFactor is 12.
) else (
    echo FormFactor is not 12.
)
The second for /F loop in this example prevents artefacts (like orphaned carriage-return characters) from converting the Unicode output of wmic to ANSI by `for /F.
If there are more than one memory module, the for /F loop is iterating over all of them, so the interim variable FF actually contains the form factor of the lastly iterated one.
If you want to execute the code in a command prompt window rather than in a batch file, regard that you have to replace %%E and %%F by %E and %F, respectively.
You can let the wmic command do the filtering using a where clause:
wmic path Win32_PhysicalMemory where FormFactor=12 get FormFactor
Then use the find command to check whether or not there are matching items, like this:
2> nul wmic path Win32_PhysicalMemory where FormFactor=12 get FormFactor /VALUE | > nul find "=" && (
    echo FormFactor is 12.
) || (
    echo FormFactor is not 12.
)
The /VALUE switch changes the output of wmic to something like FormFactor=12; find is then used to find returned lines containing =. Due to the said filtering by where there is no matching output at all if there is no such expected form factor. The && and || operators are conditional operators that react on the returned exit code of find.
Anyway, determining the form factor of the memory modules is probably not the most reliable method to find out whether your computer is a laptop (mobile); so as you already mentioned in a comment, the Win32_ComputerSystem class is a more suitable one:
2> nul wmic path Win32_ComputerSystem where PCSystemType=2 get PCSystemType /VALUE | > nul find "=" && (
    echo The computer is a laptop.
) || (
    echo The computer is not a laptop.
)