Getting Windows 8 Product ID through command-line

Here are a few ways suitable for use in batch files:

wmic os get "SerialNumber" | find /v "SerialNumber"

for /f "tokens=3" %p in ('SystemInfo ^| find "Product ID"') do @echo %p

for /f "tokens=3" %p in ('reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v ProductID') do @echo %p

It is possible by using WMI (Windows Management Interface) or by querying a value from Windows Registry.

With WMI:

  1. From the command line, type the wmic (and Enter)

  2. Inside WMI, Type OS

  3. Look over "SerialNumber" value. It contains your Windows 8 ProductID.

P.S.: Alternatively, you could also type wmic OS from cmd and search for "SerialNumber".

Reference.

With Windows Registry:

  1. Just type the folowing command from cmd:

    reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductID
    

    or even:

    reg query "HKLM\SOFTWARE\Microsoft\Internet Explorer\Registration" /v ProductID
    

    (Internet Explorer has the same ID as Windows 8.)


You can use Windows' SystemInfo command.

It will return a list of info about the system, including that Product ID (about the 9th line down give or take.)

From MS:

Displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties, such as RAM, disk space, and network cards.

If you want to extract just that line you can use systeminfo | find /i "product id".