JSI Tip 1826. Another way to determine the Windows NT product type in batch.
Jerold Schulman
November 17, 1999
1 Min Read
In tip 0643, we used the freeware gettype.exe to determine the Windows NT product type.
In tip 0869, we learned where the product type is stored in the registry, and its' possible data values.
Using the freeware REG, I have scripted JSINTPT.bat. To use it:
call jsintpt
JSINTPT will return a NTPT environment variable, which contains one of the following values:
"None"
"WinNT"
"LanmanNT"
"ServerNT"
"Terminal Server"
"Enterprise"
To test it, use statements similar to:
if %NTPT%
"None" goto other
if %NTPT%
"LanmanNT" goto dc
NOTE: You do not enclose %NTPT% in double quotes because its' value is double quoted.
JSINTPT.bat contains:
@echo offif /i "%OS%"=="Windows_NT" goto WINNTset NTPT="None"goto end:WINNTfor /f "Tokens=*" %%i in ('regfree -Quiet -ListValue hklmsystemcurrentcontrolsetcontrolProductOptionsProductType') do set NTPT="%%i"set NTPT=%NTPT:REG_SZ =%:end
About the Author
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.
You May Also Like