主页 > Windows教程 >

如何使用VBScript脚本查看Windows 11序列号

Windows教程 2023-11-14

查看 Windows 11 的序列号其实不用什么第三方工具,只需写一个 VBScript 脚本即可。该脚本同时适合 Windows 10、Windows 7和更早版本的 Windows。

如何使用VBScript脚本查看Windows 11序列号

Set WshShell = CreateObject("WScript.Shell")
strMessage = "Welcome to www.computer26.com"
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")),0,strMessage

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

要使用以上脚本非常简单,只需复制下来粘贴到一个 TXT 中,将文件的扩展名改为 .vbs 再执行就可以通过VBScript脚本查看Windows 11序列号了。


标签: 查看Windows11序列号

电脑软硬件教程网 Copyright © 2016-2030 www.computer26.com. Some Rights Reserved.