@echo off & setlocal enabledelayedexpansion
set tokens=%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat
set vbs=winkey.vbs
for /f "delims=:" %%a in ('findstr /n /b ":vbs" %0') do (more +%%a %0>"%vbs%")
for /f "delims=" %%a in ('cscript //nologo "%vbs%"') do set key=%%a
del "%vbs%"
cls
echo.&echo 提取密钥:%key%
>> .\winkey.ini echo [winkey]
>> .\winkey.ini echo key=%key%
:vbs
ON ERROR RESUME NEXT
Dim objShell
Set objShell = CreateObject("WScript.Shell")
WScript.Echo GetKey(objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function GetKey(rpk)
Const rpkOffset=52:i=28
szPossibleChars="BCDFGHJKMPQRTVWXY2346789"
Do
dwAccumulator=0 : j=14
Do
dwAccumulator=dwAccumulator*256
dwAccumulator=rpk(j+rpkOffset)+dwAccumulator
rpk(j+rpkOffset)=(dwAccumulator\24) and 255
dwAccumulator=dwAccumulator Mod 24
j=j-1
Loop While j>=0
i=i-1 : szProductKey=mid(szPossibleChars,dwAccumulator+1,1)&szProductKey
if (((29-i) Mod 6)=0) and (i<>-1) then
i=i-1 : szProductKey="-"&szProductKey
End If
Loop While i>=0
GetKey=szProductKey
End Function
THE END
暂无评论内容