Try the following command:
fme.exe info
The output will include information about:
Edition
Version
OS Locale Name
OS Encoding
Process Encoding
FME API version
Registration Key
Registration
Serial Number
Customer Number
Home Folder
Operating System
You can then use e.g. Powershell to extract the license information from the "Registration" entry.
Thanks @david_r !
I ended up using a different method in a Windows batch because it was quicker for me not to work out how to use Powershell, but its the same result basically the same except that you need to know what the license is rather than being a wildcard.
find "*LICENSE_NAME*" "C:\\ProgramData\\Safe Software\\FME\\Licenses\\fme_license.dat"
if %ERRORLEVEL% EQU 0 (
echo FME is unlicensed
) else (
echo FME is licensed
)