There are many situations where you are logged on to a Microsoft Windows Workstation or Server and need to find the domain controller for the domain that the computer is joined to.
The simplest way that works on all versions of windows is:
> echo %LOGONSERVER%
Or:
> NETCOM QUERY /Domain:<Domain FQDN> DC (note the “DC” is required at the end)