Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
September 11, 2003
Starting with Windows NT 5.0 (Windows 2000), the UserDNSDomain environment variable is populated with the DNS domain name when the user is logged on to a domain.
To test for the %UserDNSDomain% environment variable:
set dom=Nif defined UserDNSDomain set dom=Y
To define an environment variable that contains the domain or workgroup name:
set dom=Nif defined UserDNSDomain set dom=Y&set WORKGROUP=%UserDNSDomain%if "%dom%" EQU "N" For /F "tokens=3" %%i in ('Net Config Workstation^|Find /i "Workstation Domain "') Do @Set WORKGROUP=%%i
You May Also Like