Windows RT 与任何其他 OEM Windows 产品一样,在 PC 上预安装并预激活。大多数运行标准 Windows 的 PC 背面(台式机)或底部(笔记本电脑)都有产品密钥标签。大多数没有产品密钥标签的其他 PC 都附带恢复 CD,如果操作系统因任何原因无法使用,可以使用恢复 CD 将操作系统恢复到原始状态。但是,Windows RT PC 没有这些功能(至少 Surface 没有;我不确定其他 Windows RT 设备是否有)。但是,仍然可以通过进入系统属性然后选择停用选项来停用 Windows RT。如果我确实像这样意外停用了 Windows RT,是否有办法获得另一个产品密钥来再次激活它?我知道,对于 Windows 的 OEM 副本,存储在注册表中的密钥是 OEM 用于预安装 Windows 的通用密钥,而不是我的机器的特定密钥。
答案1
该脚本来自西达可以用来提取密钥,只需将其保存为.bat并运行即可。
::' Windows RT 8.0 Product Key Dumper by Myria of xda-developers.com
::' Original Windows 8.0 VBScript by janek2012 of mydigitallife.info
::' Batch+VBScript hybrid trick by dbenham of stackoverflow.com
::' Fix for keys starting with N by Osprey00 of xda-developers.com
::'
::' Windows RT doesn't let unsigned VBScript use WScript.Shell, which is
::' required in order to read the registry in VBScript. So instead, we
::' have a batch file call reg.exe to do the registry lookup for us, then
::' execute the VBScript code. Might as well do things this way, since
::' it would really suck to write this math in batch...
::' --- Batch portion ---------
rem^ &@echo off
rem^ &call :'sub
::' If we were run from double-clicking in Explorer, pause.
rem^ &if %0 == "%~0" pause
rem^ &exit /b 0
:'sub
::' Read the registry key into VBScript's stdin.
rem^ &("%SystemRoot%\System32\reg.exe" query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v DigitalProductId | cscript //nologo //e:vbscript "%~f0")
::'rem^ &echo end batch
rem^ &exit /b 0
'----- VBS portion ------------
'WScript.Echo "begin VBS"
' Get registry data that was piped in
RegData = ""
Do While Not WScript.StdIn.AtEndOfStream
RegData = RegData & WScript.StdIn.ReadAll
Loop
' Remove any carriage returns
RegData = Replace(RegData, ChrW(13), "")
' Split into lines
RegLines = Split(RegData, ChrW(10))
' Sanity checking on data
If (RegLines(0) <> "") Or (RegLines(1) <> "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion") Then
WScript.Echo "Got invalid header trying to run reg.exe"
WScript.Quit(1)
End If
If Left(RegLines(2), 38) <> " DigitalProductId REG_BINARY " Then
WScript.Echo "Got invalid value list trying to run reg.exe"
WScript.Quit(1)
End If
' Get hex string
HexString = Mid(RegLines(2), 39)
If (Len(HexString) Mod 2) <> 0 Then
WScript.Echo "Got an odd number of hex digits in REG_BINARY data"
WScript.Quit(1)
End If
' Convert to byte array
Dim ByteArray()
ReDim ByteArray((Len(HexString) / 2) - 1) ' VBScript is just weird with array dimensions >.<
For i = 0 To (Len(HexString) - 2) Step 2
ByteArray(i / 2) = CInt("&H" + Mid(HexString, i + 1, 2))
Next
Key = ConvertToKey(ByteArray)
WScript.Echo Key
' janek2012's magic decoding function
Function ConvertToKey(Key)
Const KeyOffset = 52 ' Offset of the first byte of key in DigitalProductId - helps in loops
isWin8 = (Key(66) \ 8) And 1 ' Check if it's Windows 8 here...
Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4) ' Replace 66 byte with logical result
Chars = "BCDFGHJKMPQRTVWXY2346789" ' Characters used in Windows key
' Standard Base24 decoding...
For i = 24 To 0 Step -1
Cur = 0
For X = 14 To 0 Step -1
Cur = Cur * 256
Cur = Key(X + KeyOffset) + Cur
Key(X + KeyOffset) = (Cur \ 24)
Cur = Cur Mod 24
Next
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
Last = Cur
Next
' If it's Windows 8, put "N" in the right place
If (isWin8 = 1) Then
keypart1 = Mid(KeyOutput, 2, Cur)
insert = "N"
KeyOutput = keypart1 & insert & Mid(KeyOutput, Cur + 2)
End If
' Divide keys to 5-character parts
a = Mid(KeyOutput, 1, 5)
b = Mid(KeyOutput, 6, 5)
c = Mid(KeyOutput, 11, 5)
d = Mid(KeyOutput, 16, 5)
e = Mid(KeyOutput, 21, 5)
' And join them again adding dashes
ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e
' The result of this function is now the actual product key
End Function
答案2
下面的脚本从 RT 读取唯一密钥,而不是从上面代码的 OEM 读取。
@echo off &setlocal
call :GetProductKey sWinProdKey
echo Windows Product Key: %sWinProdKey%
echo(
pause
goto :eof
:GetProductKey outVarName
setlocal EnableDelayedExpansion
set "sKeyChar=BCDFGHJKMPQRTVWXY2346789"
set "sRegKey=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
set "sRegVal=DigitalProductId"
for /f "tokens=3" %%i in ('reg query "%sRegKey%" /v "%sRegVal%"') do set "sHex=%%i"
set /a "n = 52"
for /l %%i in (104,2,132) do set /a "aRegValue_!n! = 0x!sHex:~%%i,2! , n += 1"
for /l %%b in (24,-1,0) do (
set /a "c = 0 , n = %%b %% 5"
for /l %%i in (66,-1,52) do set /a "c = (c << 8) + !aRegValue_%%i! , aRegValue_%%i = c / 24 , c %%= 24"
for %%j in (!c!) do set "sProductKey=!sKeyChar:~%%j,1!!sProductKey!"
if %%b neq 0 if !n!==0 set "sProductKey=-!sProductKey!"
)
endlocal &set "%~1=%sProductKey%" &goto :eof