(view source code of prodid.bat as plain text)
@ECHO OFF
ECHO.
IF NOT [%1]==[] GOTO Syntax
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: Export registry tree to a temporary fileSTART /WAIT REGEDIT /E "%Temp%.\test.dat" "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion"
:: Read the required value from the temporary fileFOR /F "tokens=1* delims==" %%A IN ('TYPE "%Temp%.\test.dat"') DO IF /I %%A=="ProductId" SET ProductID=%%B
:: Remove the quotesIF DEFINED ProductID SET ProductID=%ProductID:"=%
:: Delete the temporary fileIF EXIST "%Temp%.\test.dat" DEL "%Temp%.\test.dat"
:: Display the resultSET ProductID
:: DoneGOTO:EOF
:SyntaxECHO ProdID.bat, Version 1.00 for Windows NT 4 / 2000 / XP
ECHO Display Windows' Product ID and store its value in an
ECHO environment variable "ProductID"
ECHO.
ECHO Usage: PRODID
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
page last modified: 2025-10-11; loaded in 0.0052 seconds