如题所述
Set WshShell = CreateObject("WScript.Shell")
regKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
DigitalProductId = WshShell.RegRead(regKey & "DigitalProductId")
WinProductName = "Windows 产品名称: " & WshShell.RegRead(regKey & "ProductName") & vbNewLine
WinProductID = "Windows 产品 ID: " & WshShell.RegRead(regKey & "ProductID") & vbNewLine
WinProductKey = ConvertToKey(DigitalProductId)
strProductKey = "Windows 产品密钥: " & WinProductKey
WinProductID = WinProductName & WinProductID & strProductKey
'MsgBox(WinProductKey)
MsgBox(WinProductID)
Function ConvertToKey(regKey)
Const KeyOffset = 52
isWin = (regKey(66) \ 6) And 1
regKey(66) = (regKey(66) And &HF7) Or ((isWin And 2) * 4)
j = 24
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
y = 14
Do
Cur = Cur * 256
Cur = regKey(y + KeyOffset) + Cur
regKey(y + KeyOffset) = (Cur \ 24)
Cur = Cur Mod 24
y = y -1
Loop While y >= 0
j = j -1
winKeyOutput = Mid(Chars, Cur + 1, 1) & winKeyOutput
Last = Cur
Loop While j >= 0
If (isWin = 1) Then
keypart1 = Mid(winKeyOutput, 2, Last)
insert = "N"
winKeyOutput = Replace(winKeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
If Last = 0 Then winKeyOutput = insert & winKeyOutput
End If
a = Mid(winKeyOutput, 1, 5)
b = Mid(winKeyOutput, 6, 5)
c = Mid(winKeyOutput, 11, 5)
d = Mid(winKeyOutput, 16, 5)
e = Mid(winKeyOutput, 21, 5)
ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e
End Function
把上面的内容写进一个空的文本文件里面,然后另存为后缀名为vbs的文件,之后双击运行这个vbs文件,即可获取的当前系统中的密钥。
如下图运行后的效果:
追问谢谢
可通过注册表查询,具体操作步骤:
1、搜索regedit打开注册表,
依次定位:HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/SoftwareProtectionPlatform。
2、选择右侧的“BackupProductKeyDefault”键值,后面的25位字符就是Win10激活密钥。
Product Key或AIDA64