_COMPNAME — Returns the computer’s name.
_COMPNAME
Syntax: %_COMPNAME
%_COMPNAME
This variable returns the fully qualified DNS name of the computer, including the domain name if any.
echo %_compname