How to Find Windows 10 Product Key Using Command Prompt

0
28


If you’re looking for your Windows 10 product key, you can find it by entering a quick command at the command prompt. Here’s how, plus a little trick to find your product key using a Windows registry method.

Find your Windows 10 product key using the command prompt

To find your Windows 10 product key using the command prompt, you’ll need to open the command line app with administrative privileges. To do this, type “cmd” in the Windows search bar.

Scribe

The command prompt will appear in the search results. Right-click and select “Run as administrator” in the window that appears. If prompted, enter your Windows account password.

Once open, copy and paste the following command and then hit the Enter key:

wmic path softwarelicensingservice get OA3xOriginalProductKey

Then the 25-digit product key will appear.

Product key at the command prompt.

Note: This method displays the Windows product key stored in your computer’s BIOS or UEFI firmware. In other words, it displays the original Windows key that your computer came with. If you installed Windows with a different key since then (or purchased a digital license), it will be different from the current key in use on your PC. If you want the current key to be in use on your PC, NirSoft’s ProduKey or Microsoft Store’s ShowKeyPlus are good graphical tools to find it.

That’s all about it. It’s fast this way, but this isn’t likely to be a code you’ll remember very easily. If you want a faster way to access your product key in the future, you can use the Windows Registry method instead.

RELATED: How to find your Windows 11 product key

Find your Windows 10 product key using a Windows registry method

To update: This method is all over the web, but it doesn’t seem to return an actual usable key on the latest version of Windows 10. (For example, this script on Microsoft’s TechNet Gallery works differently, but also returns “DigitalProductId” results in register). As of July 2020, we recommend that you skip this section and use the previous method instead.

The Windows Registry tip was initially posted by a user (whose account is no longer active) on the Microsoft forum.

First, open Notepad by right-clicking anywhere on the desktop, hover over “New” and then select “Text Document” from the menu.

Open a new text file

Copy and paste this code into Notepad:

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLMSOFTWAREMicrosoftWindows NTCurrentVersionDigitalProductId"))

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

Then click on the “File” tab and select “Save As”.

In File Explorer, set the “Save as type” dropdown to “All Files” and give your file a name. You can use any name, but it has to be a .vbs file. You can name it something like: productkey.vbs

Save the file as a file

Once you have entered a filename, save it.

You can now view your Windows 10 product key at any time by opening the new file.

Your product key.