How to Find Your Windows 10 Product Key Using the Command Prompt?

Shaun
Dec 30, 2022
Updated • Dec 28, 2022
Tutorials, Windows 10
|
13

Finding your Windows 10 product key can be a challenge at times. Not everyone notes it down and keeps them handy. When it comes to finding it within the system, you need to know where to look. We're here to help you find your product key using simple tricks.

Using the Command Prompt

When looking for your Windows 10 product key using the command prompt, you will need to run it as an admin. To do this, you need to search 'cmd' in your search bar. When you find the command prompt, right-click on it and select 'run as administrator.' In some cases, you may be asked for your Windows password. Once the command prompt is open, paste the below code in the dialog box and press enter.

wmic path softwarelicensingservice get OA3xOriginalProductKey

You will then see a 25-digit product key on your screen. This is the product key stored in your UEFI firmware or computer BIOS. This means this is the original product key for your computer. If you've used a different key to reinstall Windows, you may need other tools to find that key.

Using the Windows Registry Method

To find your product key using the registry, open notepad. Copy and paste the below code into the notepad.

Set WshShell = CreateObject("WScript.Shell")

MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))

Function ConvertToKey(Key)

Const KeyOffset = 52

i = 28

Chars = "BCDFGHJKMPQRTVWXY2346789"

Do

Cur = 0

x = 14

Do

Cur = Cur * 256

Cur = Key(x + KeyOffset) + Cur

Key(x + KeyOffset) = (Cur \ 24) And 255

Cur = Cur Mod 24

x = x -1

Loop While x >= 0

i = i -1

KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput

If (((29 - i) Mod 6) = 0) And (i <> -1) Then

i = i -1

KeyOutput = "-" & KeyOutput

End If

Loop While i >= 0

ConvertToKey = KeyOutput

End Function

Click on the file menu at the top left and then click on 'save as.' In the explorer dialog box that opens, select 'all files' as the file type. You can give any name to the notepad; however, the extension should be .vbs. For example, you can save it as windowsproductkey.vbs.

Once you save the file, close it and open it again. Your product key will be displayed each time you open the file.

Windows 10 Find The Product Key Useful Tips & Tricks

Never Lose Your Product Key Anymore

Now that you know how to retrieve your product key, you can reinstall Windows at any time without worrying about purchasing a new license. We hope these methods helped you. Keep reading this space for more such tips and tricks.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Shawn Horton said on January 20, 2023 at 5:18 pm
    Reply

    i can use cmd to activate software insted of op sys

  2. Magic said on January 3, 2023 at 8:04 pm
    Reply

    A very interesting article, but pardon my ignorance…

    I used the Windows Registry Method as described which returned ‘a product key’ that was completely different from the one I have securely stored?! Also, on checking this key using ShowKeyPlus, it states it is ‘invalid’.

    (Note: the key I have securely stored matches what was reported by Belarc Advisor).

    I would appreciate it if someone could clarify – thanks in advance.

  3. vanp said on December 31, 2022 at 3:07 am
    Reply

    I used the Command Prompt method, and what I got back was–>OA3xOriginalProductKey.

    I think what I have is Digital Entitlement, not a Product Key. Don’t know if Digital Entitlement is the proper term anymore.

  4. Cantabrian said on December 30, 2022 at 10:20 pm
    Reply

    Thanks VioletMoon for raising the issue of transferring a product key to another machine.

    I have two old devices on their last legs and would be keen to know how to reinstall on other devices (also old but in better shape).

    The advice of “use Linux” doesn’t work in these cases due to the software needed.

  5. Mechanical computer said on December 30, 2022 at 8:13 pm
    Reply

    Martin, does this blog support CODE blocks or something similar to a monospaced font? The formatting for the script (above) isn’t that easy to differentiate from the default paragraph style.

    Syntax test: ... … …

    1. Mechanical computer said on January 2, 2023 at 10:47 am
      Reply

      Apparently the PRE test failed; therefore whitespace won’t be preserved meaning limited usefulness for formatting long scripts. Line Break Elements (BR), were automatically added to the CODE sample.

      Echo test:

      How peculiar
      How peculiar, times two

      Still, it might have been useful to have used CODE in the first place, for the single line in the article. Lacking PRE support is rather strange. :-/

    2. Mechanical computer said on December 31, 2022 at 10:47 am
      Reply

      Yes, it looks like the blog supports CODE going from that “Syntax test” above. If you notice the background colour is faintly highlighted grey and the font default font family is monospace. It would certainly be more useful if the author considered it, for one line script snippets.

      For example: wmic path softwarelicensingservice get OA3xOriginalProductKey

      Given that there doesn’t seem to be a ‘Preview Post’ function provided… I am not sure what it will do in the following syntax tests (I suspect it will try collapse onto one line):

      Set WshShell = CreateObject("WScript.Shell")
      MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
      Function ConvertToKey(Key)
      Const KeyOffset = 52
      ?
      End Function

      PRE test…

      Set WshShell = CreateObject("WScript.Shell")
      MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
      Function ConvertToKey(Key)
      Const KeyOffset = 52
      ?
      End Function

      Visual browsers typically render CODE as monospaced text.

  6. Jek Porkins said on December 30, 2022 at 7:03 pm
    Reply
  7. VioletMoon said on December 30, 2022 at 5:24 pm
    Reply

    Some variations on a theme:

    The following is a great source with the necessary links. The CMD and PowerShell commands work fine.

    1. https://answers.microsoft.com/en-us/windows/forum/all/where-is-windows-key-in-bios/49d8df6c-1e86-4a83-a5d8-788ffc173726

    2. The original forum for the VBS script–Note: “The Windows Registry tip was initially posted by a user (whose account is no longer active)”

    https://answers.microsoft.com/en-us/windows/forum/all/where-is-windows-key-in-bios/49d8df6c-1e86-4a83-a5d8-788ffc173726

    3. Two tools–ShowKeyPlus is the best option since it works with Windows 10 and 11. Plus it will show ALL keys embedded–the one in use and any others on the computer.

    ShowKeyPlus

    https://apps.microsoft.com/store/detail/showkeyplus/9PKVZCPRX9NV?hl=en-us&gl=us

    NeoSmart

    https://neosmart.net/OemKey/

    Probably not in one’s best interest to store the Product Key on the same computer that needs a reinstall.

    Maybe an article on if and when a Product Key can be transferred to another machine with different hardware; or how to re-activate a license if one changes enough hardware on the same machine. It gets somewhat complicated.

  8. John G. said on December 30, 2022 at 2:05 pm
    Reply

    Thanks @Shaun for the article. :]

  9. grammar said on December 30, 2022 at 12:58 pm
    Reply

    This is not a question?

  10. ilev said on December 30, 2022 at 10:07 am
    Reply

    Find all OS and software keys with free Belarc app.

    1. Anonymous said on January 20, 2023 at 5:13 pm
      Reply

      this is for software not op sys

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.