@color 1F & echo off
@title KMS Online Activation by Desen
mode con cols=120 lines=60
reg add HKEY_CURRENT_USER\Console\%%SystemRoot%%_system32_cmd.exe /v "WindowPosition" /t REG_DWORD /d 0x001401c2 /f
cls
echo 请右键 "以管理员身份运行" 此批处理脚本
echo ===================================================
echo 以下 KMS 密钥来源于微软
echo Office 2016:https://docs.microsoft.com/zh-cn/DeployOffice/vlactivation/gvlks
echo Office 2013:https://docs.microsoft.com/zh-cn/previous-versions/office/dn385360(v=office.15)
echo Office 2010:https://docs.microsoft.com/zh-cn/previous-versions/office/office-2010/ee624355(v=office.14)
echo Windows:https://docs.microsoft.com/zh-cn/windows-server/get-started/kmsclientkeys
echo 备用 KMS 服务器:kms.2bmi.com
set KMS=kms.03k.org
echo ===================================================
echo 开始执行 Microsoft Windows 激活
set CSCRIPT="C:\Windows\system32\cscript.exe"
set SLMGR="C:\Windows\system32\slmgr.vbs"
%CSCRIPT% %SLMGR% /ckms
%CSCRIPT% %SLMGR% /upk
%CSCRIPT% %SLMGR% /skms %KMS%
echo 弹出提示窗口请单击 "确定" 按钮继续
for /F "tokens=3" %%a in ('wmic os get Caption /VALUE') do ( if "%%a" NEQ "" (set "VER=%%a") )
set "VER=%VER: =%"
if "%VER%" EQU "10" (set "SN=6TP4R-GNPTD-KYYHQ-7B7DP-J447Y")
if "%VER%" EQU "7" (set "SN=FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4")
for /F "tokens=5" %%b in ('wmic os get Caption /VALUE') do ( if "%%b" NEQ "" (set "LTSC=%%b") )
if "%LTSC%" EQU "LTSC" (set "SN=M7XTQ-FN8P6-TTKYV-9D4CC-J462D")
if "%SN%" NEQ "" (%SLMGR% /ipk %SN%) else (goto SNERR)
%CSCRIPT% %SLMGR% /ato
%CSCRIPT% %SLMGR% /dlv
echo 如果激活失败请执行 cscript %SLMGR% /rearm 命令后重启系统并重新激活
echo ===================================================
echo 开始执行 Microsoft Office 激活
if EXIST "C:\Program Files\Microsoft Office\Office14\OSPP.VBS" (set "KEY=VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB")
if EXIST "C:\Program Files\Microsoft Office\Office14\OSPP.VBS" (set OSPP="C:\Program Files\Microsoft Office\Office14\OSPP.VBS")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS" (set "KEY=VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS" (set OSPP="C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS")
if EXIST "C:\Program Files\Microsoft Office\Office15\OSPP.VBS" (set "KEY=YC7DK-G2NP3-2QQC3-J6H88-GVGXT")
if EXIST "C:\Program Files\Microsoft Office\Office15\OSPP.VBS" (set OSPP="C:\Program Files\Microsoft Office\Office15\OSPP.VBS")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS" (set "KEY=YC7DK-G2NP3-2QQC3-J6H88-GVGXT")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS" (set OSPP="C:\Program Files\Microsoft Office\Office15\OSPP.VBS")
if EXIST "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" (set "KEY=XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99")
if EXIST "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" (set OSPP="C:\Program Files\Microsoft Office\Office16\OSPP.VBS")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" (set "KEY=XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99")
if EXIST "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" (set OSPP="C:\Program Files\Microsoft Office\Office16\OSPP.VBS")
%CSCRIPT% %OSPP% /remhst
%CSCRIPT% %OSPP% /sethst:%KMS%
if "%KEY%" NEQ "" (%CSCRIPT% %OSPP% /inpkey:%KEY%) else (goto KEYERR )
%CSCRIPT% %OSPP% /act
%CSCRIPT% %OSPP% /dstatus
echo 如果激活失败请执行 cscript %OSPP% /rearm 命令后重新激活
goto EXIT
:SNERR
echo 没有找到 Windows 对应的密钥, Windows 激活失败
goto EXIT
:KEYERR
echo 没有找到 Office 对应的密钥, Office 激活失败
goto EXIT
:EXIT
echo ===================================================
echo 5 秒后自动退出,谢谢使用!
ping 127.1 -n 5 > nul