分享

还不备份序列号?再不备份就晚啦

 语之翠 2019-08-18

题外话:关注我,每天都有稀奇古怪的干货文章哦,想看什么也可以私信我

许多windows用户每到重装系统后都可能会出现下面的情形

“诶?当初那个记着序列号的盒子呢?”

经过一番大搜查也没有找到,最后只能随便找一个不知道从哪来的序列号填进去

当然,如果你从最初就没有自己的正版序列号的话,那我也无话可说,但是希望你不要把这当成炫耀的资本

本文仅献给拥有正版系统的windows用户,教大家如何快速查到自己的序列号

当然,如果你不想每次都用神秘软件激活的话,这篇文章同样适合你

废话不多说,开整!

Win10用户

如果你现在是win10用户的话,那实在是太幸运了,因为win10系统仅仅需要一条命令就可以完成

按下win+r键,输入cmd,打开命令提示符

输入下面这一行命令

wmic path softwarelicensingservice get OA3xOriginalProductKey

出现的那一串就是你的序列号,直接记下来就ok了

Win7用户

是不是看到上面win10用户查找起来很方便!

非常遗憾的告诉你,其他的系统版本就没有那么简单了

网上查找序列号的方法很多很多,但是都相当的麻烦,比如查注册表啊下软件扫描查看啊什么的

今天我们用一个vbs文件来解决

打开一个记事本,在里面输入以下代码

Option Explicit

ON ERROR RESUME NEXT

Dim g_strComputer, g_objRegistry, g_EchoString

g_strComputer = '.'

g_EchoString = ''

private const L_MsgErrorPKey                          = '没有安装Windows序列号, 以下为注册表残留信息。'

private const L_MsgErrorRegPKey                       = '没有在注册表中找到Windows序列号.'

private const L_MsgErrorRegPID                        = '没有在注册表中找到Windows产品ID.'

Private const L_MsgProductName                        = '系统:'

private const L_MsgProductDesc                        = '系统描述: '

private const L_MsgVersion                            = '版本号: '

Private Const L_MsgServicePack                        = '补丁包:'

Private Const L_MsgBuild                              = '编译代号:'

private const L_MsgProductKey                         = '序列号: '

private const L_MsgProductId                          = '产品ID: '

private const HKEY_LOCAL_MACHINE                      = &H80000002

Private Const WindowsNTInfoPath                       = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'

'If this is the local computer, set everything immediately

If g_strComputer = '.' Then

Set g_objRegistry = GetObject('winmgmts:\\' & g_strComputer & '\root\default:StdRegProv')

End If

Call ExecCommand()

Call ShowInfo()

ExitScript 0

Private Sub ExecCommand

Dim productKeyFound

Dim strProductKey, strProductId, strProductVersion, strTmp

Dim bRegPKeyFound, bRegPIDFound        ' value exists in registry

'Retrieve information from registry

bRegPKeyFound = False : bRegPIDFound = False : productKeyFound = False

g_objRegistry.GetBinaryValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'DigitalProductId', strTmp

If Not IsNull(strTmp) Then

strProductKey=GetKey(strTmp)

bRegPKeyFound = True

End If

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'ProductId', strTmp

If Not IsNull(strTmp) Then

strProductId = strTmp

bRegPIDFound = True

End If

LineOut ''

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'ProductName', strTmp

LineOut GetResource('L_MsgProductName') & strTmp

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'CSDVersion', strTmp

If Not IsNull(strTmp) Then

LineOut GetResource('L_MsgServicePack') & strTmp

End If

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'CurrentVersion', strProductVersion

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'CurrentBuildNumber', strTmp

strProductVersion=strProductVersion & '.' & strTmp

LineOut GetResource('L_MsgVersion') & strProductVersion

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'BuildLabEx', strTmp

If IsNull(strTmp) Then

g_objRegistry.GetStringValue HKEY_LOCAL_MACHINE, WindowsNTInfoPath, 'BuildLab', strTmp

End If

LineOut GetResource('L_MsgBuild') & strTmp

productKeyFound = True

LineOut ''

If productKeyFound <> True Then

LineOut GetResource('L_MsgErrorPKey')

End If

If bRegPKeyFound Then

LineOut GetResource('L_MsgProductKey') & strProductKey

Else

LineOut GetResource('L_MsgErrorRegPKey')

End If

If bRegPIDFound Then

LineOut GetResource('L_MsgProductId') & strProductId

Else

LineOut GetResource('L_MsgErrorRegPID')

End If

LineOut ''

LineOut '本程序用来获取查看Windows的序列号。'

LineOut '适用于绝大多数Windows系统,包括 XP/Vista/Win7/Win10 系列等。'

LineOut '记得关注搞科技的加藤惠,不要做伸手党哦'

End Sub

Private Sub ShowInfo

Dim Ans, objFSO, outFile, strSave

Set objFSO = CreateObject('Scripting.FileSystemObject')

strSave = vbNewLine & '-----------------------------------------------------------' & vbNewLine & g_EchoString

strSave = strSave & vbNewLine & vbNewLine& '------ ' & Now() & '    ' & 'Windows 序列号查看器保存' & ' ------' & vbNewLine

LineOut ''

LineOut ''

LineOut '是否保存以上信息到文本文件 WindowsKey.txt ?'

Ans = MsgBox(g_EchoString, 4, 'Windows 序列号查看器')

g_EchoString = ''

If Ans = vbYes Then

Set outFile = objFSO.OpenTextFile('.\WindowsKey.txt', 8 , True) ' append to file

outFile.WriteLine strSave

outFile.Close

LineOut '已经保存到文件 WindowsKey.txt !'

End If

End Sub

Private Function GetKey(rpk)   'Decode the product key

Const rpkOffset=52

Dim dwAccumulator, szPossibleChars, szProductKey

dim i,j

i=28 : szPossibleChars='BCDFGHJKMPQRTVWXY2346789'

Do 'Rep1

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 'Goto Rep1

GetKey=szProductKey

End Function

' Get the resource string with the given name using the built-in default.

Private Function GetResource(name)

GetResource = Eval(name)

End Function

Private Sub ExitScript(retval)

if (g_EchoString <> '') Then

MsgBox g_EchoString, 0, 'Windows 序列号查看器'

End If

WScript.Quit retval

End Sub

' Functions Without Change Below

Private Sub LineOut(str)

g_EchoString = g_EchoString & str & vbNewLine

End Sub

关闭,保存,修改文件后缀为vbs,大功告成

我们来点击运行一下

怕手抖记错序列号?不要担心,还能一键保存,妈妈再也不用担心我记不住了

发文不易,欢迎各位关注,点赞,评论,转发素质四连,每天都有稀奇古怪的干货文章,想看什么也可以私信我哦

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多