7

I know it is possible to find the Windows 8 Product ID in the "System" page located in the Control Panel.

But is it possible to get the Windows 8 Product ID using the command prompt?

amiregelz
  • 8,099
  • 12
  • 48
  • 58

4 Answers4

10

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
Karan
  • 55,947
  • 20
  • 119
  • 191
  • 2
    `wmic os get "SerialNumber"` works great. – amiregelz Oct 30 '12 at 18:46
  • 1
    Yup, the extra find bit is just so it returns the PID only and no other text, so you can easily assign it to a variable for example. – Karan Oct 30 '12 at 18:47
  • Actually it still return "SerialNumber" text. – Diogo Oct 30 '12 at 18:48
  • 1
    Are you sure? It doesn't for me, if I use the entire command specified with the find bit included. I tested all 3 before posting. – Karan Oct 30 '12 at 18:49
  • Yes, type it and you will see that the text "SerialNumber" comes before the ID itself. Test it by using a pipe, for example wmic os get "SerialNumber" > txt.txt, then open txt.txt on notepad. – Diogo Oct 30 '12 at 19:07
  • Hmm, probably you are reffering to the entire script, from the answer, I'm talking about wmic os get "SerialNumber" from @amiregelz comment, sorry. – Diogo Oct 30 '12 at 19:08
  • 1
    Precisely. The `find /v` bit removes all other lines except the one displaying the SerialNumber. – Karan Oct 30 '12 at 19:10
4

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.)

Diogo
  • 30,192
  • 65
  • 150
  • 222
  • This returns a very long line of text (or a very messy text if I type `wmic OS`). Is it possible to get only the Product ID? – amiregelz Oct 30 '12 at 18:44
  • Edited, by using the second method yes...(It looks weird but Internet Explorer have the same ID as Windows) – Diogo Oct 30 '12 at 18:45
2

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".

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
2

use following command:

wmic path softwarelicensingservice get OA3xOriginalProductKey

Tested on my genuine @in 8.1 64 bit. Reference - http://www.thewindowsclub.com/find-windows-product-key