我可能没有这样做,但我正在尝试修改VBScript以查找Windows产品密钥以支持查找Microsoft Office Pro的产品密钥。这是代码,但我希望“unknown”文件夹名称与通配符具有相同的效果。我知道在VBScript中无法使用实际的通配符,但是如何在脚本中返回“DigitalProductID”的注册表值而不指定“unknown”文件夹?或者我在其他地方更改代码?
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Registration\unknown\DigitalProductId"))
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
regedit
并手动查找“未知”部分,替换命中并运行脚本?