Home Work How to Use the Command Prompt to Locate Your Windows 10 Product Key

How to Use the Command Prompt to Locate Your Windows 10 Product Key

by Kevin
How to Use the Command Prompt to Locate Your Windows 10 Product Key


Use the Command Prompt and type a brief command to find your Windows 10 product key. Here’s how, along with a cunning little method for retrieving the product key using the Windows Registry.

Key Takeaway

To retrieve your Windows 10 product key, open Command Prompt as administrator, run “wmic path softwarelicensingservice get OA3xOriginalProductKey” into Command Prompt, and then press Enter. If your PC arrived with Windows 10 pre-installed, the command will merely display a product key.

Using the Command Prompt, Locate Your Windows 10 Product Key

To use the Command Prompt to find your Windows 10 product key, use the command line program with administrator capabilities. To do so, open the Windows search bar and type “cmd.”

Type "cmd" in search bar.

The search results will include Command Prompt. Right-click it and choose “Run As Administrator” from the resulting popup. Enter your Windows account password if asked.

Once the window is open, copy and paste the following command and press the Enter key:

wmic path softwarelicensingservice get OA3xOriginalProductKey

The 25-digit product key will then be shown.

Windows Product Key in Command Prompt.

This approach shows the Windows product key saved in the BIOS or UEFI firmware of your machine. In other words, it displays the actual Windows key that came with your machine. If you’ve installed Windows with a new key since then (or obtained a digital license), it will be different from the one you’re currently using on your PC. NirSoft’s ProduKey or ShowKeyPlus from the Microsoft Store are effective graphical tools for locating the current key in use on your PC.

Please keep in mind that NirSoft’s ProduKey will very certainly activate your antivirus. Because of what ProduKey does and how it performs it, your antivirus software believes it is or may be dangerous. You won’t have to worry about anything if you download it from the official site.

That’s the end of it. This method is quick, but it is unlikely that you will remember the code. If you want to access your product key more quickly in the future, you may utilize the Windows Registry approach instead.

Using the Windows Registry, Locate Your Windows 10 Product Key

Update:This approach is widely used on the internet, however it does not appear to provide a valid key on the most recent version of Windows 10. (For example, this script in Microsoft’s TechNet gallery works differently, but it also reads the registry value “DigitalProductId.”) As of July 2020, we recommend skipping this step and instead using the procedure outlined above.

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

To begin, right-click anywhere on the desktop, hover over “New,” and then pick “Text Document” from the menu.

Open a new text file

Copy and paste the following code into 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
Cur = 0
x = 14
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, under the “File” menu, select “Save As.”

Set the “Save As Type” selection to “All Files” in File Explorer and name your file. You may give it any name you like, but it must be a.vbs file. You may call it something like productkey.vbs.

Save file as a ".vbs" file.

Save the file after you’ve given it a name.

By accessing the new file, you may now view your Windows 10 product key at any time.

Your Product Key.

You may also like

Navhow is dedicated to teaching people all over the world how to do anything.



The Best How-To Newsletter Anywhere

©2022 Navhow, All Right Reserved