I have scripted GetDC.bat to return a call directed environment variable with the name of a domain controller in the specified domain, or NO, if a domain controller cannot be located.

The syntax for using GetDC.bat is:

call getdc DomainName DomainController

where DomainName is the name of the domain you are interrogating
and DomainController is the call directed environment variable that will contain \\DomainControllerComputerName, if you used a NetBIOS domain name,
or \\DomainControllerComputerName.DNSDomainName (like \\JSI001.JSIINC.COM) if you used a DNS domain name.

GetDC.bat contains: