Skip navigation

JSI Tip 1826. Another way to determine the Windows NT product type in batch.


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 off
if /i "%OS%"=="Windows_NT" goto WINNT
set NTPT="None"
goto end
:WINNT
for /f "Tokens=*" %%i in ('regfree -Quiet -ListValue hklm\system\currentcontrolset\control\ProductOptions\ProductType') do set NTPT="%%i"
set NTPT=%NTPT:REG_SZ =%
:end

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish