_WORKGROUP — Returns the name of the computer’s workgroup.

Syntax:
%_WORKGROUP

If the computer is a member of a domain, this variable returns an empty string.


echo %_workgroup